options = optimoptions('fmincon','Display','iter','Algorithm','sqp'); fun = @(x)sum((x.*(log(x)))); A = []; b = []; lb = [0,0,0,0,0]; ub = [1,1,1,1,1]; Aeq = [1,1,1,1,1;0,1,2,3,4]; beq = [1;3]; x0 = [.2 .2 .2 .2 .2]; x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfn,options); display(x)
where the non linear function is:
function [c,ceq] = nonlinfn(x) c = []; ceq = sum(x.*x)-1;
If
ceq = @(x)sum(x.*x)-1
is used, gives a result but the results is same if we don't use the non linear constraint. Now why arguments are few?
Best Answer