Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

I am beginner of Matlab. While I use MATLAB to solve the problem of constrained nonlinear optimization, "Lack of input arguments" are always warning.Did someonecan tell me how to slove this probrem?THx

Asked by GAO Si

GAO Si (view profile)

on 7 Dec 2012

function f=optfun(x) f=-x(1)*x(2)*x(3); %fmincon_example.m X0=[1,1,1]; A=[1,2,2;0,1,0;0,0,1]; b=[72;5;10]; x=fmincon(optfun,X0,A,b) end

1 Comment

'x' is an input argument or output argument?

GAO Si

GAO Si (view profile)

Products

1 Answer

Answer by Vishal Rane

Vishal Rane (view profile)

on 7 Dec 2012
function f=optfun(x)
   f=-x(1)*x(2)*x(3); %fmincon_example.m 
   X0=[1,1,1];
   A=[1,2,2;0,1,0;0,0,1];
   b=[72;5;10];
   x=fmincon(optfun,X0,A,b) 
end

You are not providing the input x to optfun when passing it as an input to fmincon (last line) .

0 Comments

Vishal Rane

Vishal Rane (view profile)

Contact us