Hello ,
I have a code
a,b —–> variables should be vector(like a=[a1,a2,a3,a4])
x=h1*a^2+h2*b^2+h3;——>objctive fun(h1,h2,h3 are constants let say which has 1*4 value)
—->constraints are also present here.. so I am writting the code like
for i=1:4x(i)=h1(i)*a^2+h2(i)*b^2+h3(i)endobj=sum(x);----->(objective function is basically summation of x )x0=[1,1];lb = [];ub = [];Aeq = [];beq =[];A = [];b = []; fun=@(p) obj(p(1),p(2));nonlcon =@constraintfcn;opts = optimoptions('fmincon','Display','iter','Algorithm','sqp'); [x_value,fval] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,opts);
But I am not getting the ans,I want optimized value as vector .
Best Answer