Hi, I've been working on a hw assignment for a while trying to self teach optimization and its proving difficult. I have to minimize the function x1^3-6x1^2+11x1+x3 with the following constraints:
x1^2+x2^2-x3^2<=0 4-x1^2-x2^2-x3^2<=0 x3-5<=0 -x1<=0 -x2<=0 -x3<=0 the starting feasible point is .1,.1,3 So far, by looking at the tutorials I've come up with this coding, but I'm getting an error message about the function definition, saying "x and fval may not be used". Also, the code runs and in the command window k>> appears. Any help would be appreciated.
function f=mae342hw5p2(x) f=x1.^3-6.*x1.^2+11.*x1+x3; function [c,ceq]=confun(x) c=[ x1^2+x2^2-x3^2; 4-x1^2-x2^2-x3^2; x3-5;-x1;-x2;-x3]; ceq = ; x0=[.1 .1 3]; options=optimset('Algorithm','active-set'); [x,fval]=... fmincon(@mae342hw5p2,x0,,,,,,,@confun,options);