user2813234
user2813234

Reputation:

Minimizing a multivariable function in several variables in MATLAB

I need to minimize a nonlinear function subject to constraints, where everything is a parameter - no numbers.

Does anyone know if this is possible in MATLAB?

Here are the details:

Find the minimum of (2A-MB)G(F+H+J+K+L)+A(B+C+D)(E+F)-(MC-A)^2 with 
A,B,C,D,E,F,G,H,J,K,L > 0.

Thanks for any help.

Upvotes: 0

Views: 4318

Answers (1)

Adarsh Chavakula
Adarsh Chavakula

Reputation: 1599

You can use fmincon.

Here is the documentation for the function: http://www.mathworks.in/help/optim/ug/fmincon.html

The objective function would have to be written in a separate m-file which takes a vector x as it's input and returns a scalar output. Multiple variables are passed as x[1], x[2], x[3] etc.

x0 is a vector of initial guesses for the variables. Here they are all initialized to 1. It's of length 12 here as there seem to be 12 variables (including 'M').

x0 = ones(12,1)
[x,fval] = fmincon(@fun,x0,[],[],[],[],zeros(12,1),[])

This link will help you understand how to write the objective functions for multiple variables:

http://www.mathworks.in/help/optim/ug/writing-objective-functions.html#brhkghv-4

Upvotes: 2

Related Questions