optimization function in matlab

1 Ansicht (letzte 30 Tage)
mohammed hussein
mohammed hussein am 29 Nov. 2015
Kommentiert: mohammed hussein am 30 Nov. 2015
i would like to ask about the optimization in matlab function that works with multi variable input with each input has different boundaries the output is only one variables

Akzeptierte Antwort

John D'Errico
John D'Errico am 29 Nov. 2015
help fmincon
Or, as found on the file exchange, fminsearchbnd.
  5 Kommentare
John D'Errico
John D'Errico am 30 Nov. 2015
Read the help for fmincon.
You cannot simply pass in a list of variables in any order as arguments and expect fmincon to know that the 3rd and 4th arguments are to be interpreted as bounds.
READ THE HELP!!!!!
[x,fval,exitflag,output] = fmincon(fun,x0,[],[],[],[],Lb,Ub);
As you were passing in those arguments, fmincon thought they were to be treated as the equations for a set of linear INEQUALITY constraints. As such, what it thought were A and b were inconsistent in size.
mohammed hussein
mohammed hussein am 30 Nov. 2015
Thank you john

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Torsten
Torsten am 30 Nov. 2015
fun = @(x)(x(1)-5)^2+(x(2)+6)^2+x(3);
x0 = [1 1 1];
Lb=[0 -1 2];
Ub=[1 2 3];
[x,fval,exitflag,output] = fmincon(fun,x0,[],[],[],[],Lb,Ub);
disp(fval)
Best wishes
Torsten.

Kategorien

Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by