Answered

export m-file with fmincon to C-Code for PowerPC

Hi Daniel, Generating C-Code from MATLAB code that includes optimization solvers such as fmincon is currently not supported. ...

export m-file with fmincon to C-Code for PowerPC

Hi Daniel, Generating C-Code from MATLAB code that includes optimization solvers such as fmincon is currently not supported. ...

11 years ago | 0

| accepted

Solved

Weighted average

Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

11 years ago

Solved

Make a checkerboard matrix

Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Example...

11 years ago

Solved

Find all elements less than 0 or greater than 10 and replace them with NaN

Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

11 years ago

Solved

Distance walked 1D

Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...

11 years ago

Answered

Nonlinear fit to multiple data sets with shared parameters

So if I understand correctly, you want to fit tau1, tau2, tau3 to all the data, but the other parameters are fit on an individua...

Nonlinear fit to multiple data sets with shared parameters

So if I understand correctly, you want to fit tau1, tau2, tau3 to all the data, but the other parameters are fit on an individua...

11 years ago | 0

Solved

Generate a vector like 1,2,2,3,3,3,4,4,4,4

Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

11 years ago

Answered

Plotyy - Managing the colors of y-labels

For (1) you can set the YColor property of each of the axes, for example: set(AX(1),'YColor','k'); For (2), if you just ...

Plotyy - Managing the colors of y-labels

For (1) you can set the YColor property of each of the axes, for example: set(AX(1),'YColor','k'); For (2), if you just ...

11 years ago | 1

| accepted

Answered

Solve Non Linear Equations using fsolve

From what I can tell this problem has 1600 equations and only 4 unknowns, which would mean it is overdetermined and likely doesn...

Solve Non Linear Equations using fsolve

From what I can tell this problem has 1600 equations and only 4 unknowns, which would mean it is overdetermined and likely doesn...

11 years ago | 1

Answered

how can I change symbols in symbolic equations with x(1), x(2), ...

I believe the _matlabFunction_ function is what you are looking for: <http://www.mathworks.com/help/toolbox/symbolic/matlabfu...

how can I change symbols in symbolic equations with x(1), x(2), ...

I believe the _matlabFunction_ function is what you are looking for: <http://www.mathworks.com/help/toolbox/symbolic/matlabfu...

11 years ago | 0

Answered

matlab2012a vs matlab20111b. Why does the latter produces an error message?

I think the cause here is that fminunc was updated in R2012a to attempt to recover when the objective function returns NaN or In...

matlab2012a vs matlab20111b. Why does the latter produces an error message?

I think the cause here is that fminunc was updated in R2012a to attempt to recover when the objective function returns NaN or In...

11 years ago | 2

| accepted

Answered

How to fit parameters in an m.file to a curve?

Take a look at lsqcurvefit from the Optimization Toolbox. <http://www.mathworks.com/help/toolbox/optim/ug/lsqcurvefit.html>...

How to fit parameters in an m.file to a curve?

Take a look at lsqcurvefit from the Optimization Toolbox. <http://www.mathworks.com/help/toolbox/optim/ug/lsqcurvefit.html>...

11 years ago | 0

| accepted

Answered

A very simple question for GA

It looks like there is an issue with the way your decision variables are defined. The input to the objective function (which is...

A very simple question for GA

It looks like there is an issue with the way your decision variables are defined. The input to the objective function (which is...

11 years ago | 0

| accepted

Answered

Genetic Algorithm - weights ensemble optimization

Hi Michiel, If you aren't 100% set on using a Genetic Algorithm, I recommend starting with a gradient-based optimization solver...

Genetic Algorithm - weights ensemble optimization

Hi Michiel, If you aren't 100% set on using a Genetic Algorithm, I recommend starting with a gradient-based optimization solver...

11 years ago | 0

Answered

Optimization in LinProg

Hi Meemai, The message "Optimization Terminated" means that the optimization completed as normal. If you look at the value o...

Optimization in LinProg

Hi Meemai, The message "Optimization Terminated" means that the optimization completed as normal. If you look at the value o...

11 years ago | 2

| accepted

Answered

Optimization Toolbox - Choosing a Solver

Hi Norbert, Since your decision variable shift will need to be an integer (it's being used as an index), you would need to use ...

Optimization Toolbox - Choosing a Solver

Hi Norbert, Since your decision variable shift will need to be an integer (it's being used as an index), you would need to use ...

11 years ago | 1

Answered

matrix inside a matrix

The REPMAT and DIAG commands should be able to do what you need: A = repmat([3;4;5],5,1) B = diag(A,0) Check out the ...

matrix inside a matrix

The REPMAT and DIAG commands should be able to do what you need: A = repmat([3;4;5],5,1) B = diag(A,0) Check out the ...

11 years ago | 0

| accepted

Answered

Mixed integer optimisation with genetic algorithm problem

Hi Calen, The GA solver uses a penalty function when optimizing mixed-integer problems. The penalty function takes into accoun...

Mixed integer optimisation with genetic algorithm problem

Hi Calen, The GA solver uses a penalty function when optimizing mixed-integer problems. The penalty function takes into accoun...

11 years ago | 0

Answered

How can I save the settings of fsolve in the optimization tool ?

You can create an options structure in your MATLAB function and then pass that structure to FSOLVE. The options structure is cre...

How can I save the settings of fsolve in the optimization tool ?

You can create an options structure in your MATLAB function and then pass that structure to FSOLVE. The options structure is cre...

11 years ago | 1

| accepted

Answered

OUT OF MEMORY

This looks like it might help: <http://www.mathworks.com/products/image/description7.html>

OUT OF MEMORY

This looks like it might help: <http://www.mathworks.com/products/image/description7.html>

11 years ago | 1

| accepted

Answered

Optimization Technique

If you're trying to minimize or maximize Y, and Y is a scalar, I'd recommend trying <http://www.mathworks.com/help/toolbox/optim...

Optimization Technique

If you're trying to minimize or maximize Y, and Y is a scalar, I'd recommend trying <http://www.mathworks.com/help/toolbox/optim...

11 years ago | 0

| accepted

Solved

Make an awesome ramp for a tiny motorcycle stuntman

Okay, given a vector, say v=[1 3 6 9 11], turn it into a matrix 'ramp' like so: m=[1 3 6 9 11; 3 6 9 11 0; 6 9 ...

11 years ago

Answered

Lsqcurvefit on function depending on syms

Hi Gustav, You'll first need to use the matlabFunction command to convert the symbolic equation into a MATLAB function handle...

Lsqcurvefit on function depending on syms

Hi Gustav, You'll first need to use the matlabFunction command to convert the symbolic equation into a MATLAB function handle...

11 years ago | 0

| accepted

Answered

Solving overdeterminated linear equation system with specified conditions

Hi Thomas, If you have the Optimization Toolbox, LSQLIN can solve constrained least-squares problems: <http://www.mathworks.com...

Solving overdeterminated linear equation system with specified conditions

Hi Thomas, If you have the Optimization Toolbox, LSQLIN can solve constrained least-squares problems: <http://www.mathworks.com...

11 years ago | 1

| accepted

Answered

Optimization: share additional output of cost function with constraint function

There was a good discussion on this issue here: <http://www.mathworks.com/matlabcentral/newsreader/view_thread/269936> The te...

Optimization: share additional output of cost function with constraint function

There was a good discussion on this issue here: <http://www.mathworks.com/matlabcentral/newsreader/view_thread/269936> The te...

11 years ago | 1

| accepted

Answered

How to use the OutputFcns function in the optimset options?

<http://www.mathworks.com/help/techdoc/math/bsgpq6p-23.html>

How to use the OutputFcns function in the optimset options?

<http://www.mathworks.com/help/techdoc/math/bsgpq6p-23.html>

11 years ago | 0

Answered

For LSQNONLIN is it okay if the number of elements in the vector-valued function varies per iteration?

Hi Kevin, LSQNONLIN is using the values in the Fopt vector to determine the gradient, and it does this by calculating Fopt at...

For LSQNONLIN is it okay if the number of elements in the vector-valued function varies per iteration?

Hi Kevin, LSQNONLIN is using the values in the Fopt vector to determine the gradient, and it does this by calculating Fopt at...

11 years ago | 2

| accepted

Answered

GA optimization

Use GAOPTIMSET: <http://www.mathworks.com/products/global-optimization/demos.html?file=/products/demos/shipping/globaloptim/ga...

GA optimization

Use GAOPTIMSET: <http://www.mathworks.com/products/global-optimization/demos.html?file=/products/demos/shipping/globaloptim/ga...

11 years ago | 0

Answered

GA optimization

You can create a function handle to the network and then pass that function handle into GA. Note that GA will pass in a row vec...

GA optimization

You can create a function handle to the network and then pass that function handle into GA. Note that GA will pass in a row vec...

11 years ago | 4

| accepted