function f = objectivefcn1(a)psi = 0;L=1;ds=L/3999;s=0:ds:L;for n = 1:100 psi = psi + a(n)*cos(2*pi*n*s);endf=-(trapz(s,cos(psi))*(1-0.5).*(1-trapz(s,cos(psi).^2)))/(1-0.5*trapz(s,cos(psi).^2));enda0=zeros(1,100); a0(1)=1; options = optimset('MaxFunEvals', 10000*80,'MaxIter ',10000*80); a = fminsearch(@objectivefcn1,a0,options);
MATLAB: I have an optimization problem but i can’t impose the constraints i want, please help. The constraint i want is psi between -pi and pi
fminsearchoptimazation
Best Answer