optimization function in matlab

조회 수: 1 (최근 30일)
mohammed hussein
mohammed hussein 2015년 11월 29일
댓글: mohammed hussein 2015년 11월 30일
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

채택된 답변

John D'Errico
John D'Errico 2015년 11월 29일
help fmincon
Or, as found on the file exchange, fminsearchbnd.
  댓글 수: 5
John D'Errico
John D'Errico 2015년 11월 30일
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 2015년 11월 30일
Thank you john

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Torsten
Torsten 2015년 11월 30일
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.
  댓글 수: 1
mohammed hussein
mohammed hussein 2015년 11월 30일
Thank you Torsten It is working

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by