Problem in fmincon solver
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello all,
My aim is to solve for complicated non linear system of equations defined as follows:
Unknown variables: epsi, da, dr, phi1, Jr, Ja
Known variables: alpha= 40 deg, Z=16, Kn=4.5080*10(^5), Fr=Fa=17800
Equations are defined as follows:
epsi = 0.5 * (1 + da*tan(alpha) / dr)
phi1 = cosinv (-da*tan(alpha) / dr)
Jr=integration from -phi1 to phi1 of (1/(2*pi)) * (1 - (0.5/epsi) * (1-cos(theta) ) )^(1.5) * cos(theta)
Ja=integration from -phi1 to phi1 of (1/(2*pi)) * (1-(0.5/epsi) * (1-cos(theta) ) )^(1.5)
Fr / Fa = (Jr * cos(alpha)) / (Ja * sin(alpha))
To solve for these system of equations I am using fmincon function available in matlab..
My Matlab code is as follows:
Z=16, KN1=4.5080e5; Fr=Fa=17800; alpha=40;
%optimization for load distribution
%KN1=Kn(5);
%for i=1:1:length(Kn)
[dr, Epsi]=opt();
function [dopt,EPSI] = opt()
dr0=[0.08; 0.1];
lb=[0, 0];
ub=[1, 1];
Options=optimset('Algorithm','active-set','Display','Iter');
dopt=fmincon(@myfun,dr0,[],[],[],[],lb,ub,@mycon,Options);
EPSI=myfun(dopt);
end
function epsi=myfun(dr)
epsi=0.5*(1+dr(1)*tand(alpha)/(dr(2)));
end
function [c,ceq]=mycon(dr)
c=abs(-dr(1)*tand(alpha)/dr(2))-1;
phi1=acos(-dr(1)*tand(alpha)/dr(2));
epsi=0.5*(1+(dr(1)*tand(alpha)/dr(2)));
c=-1+(0.5/epsi).*(1-cos(phi1));
funr=@(theta)(1/(2*pi)).*(1-(0.5/epsi).*(1-cos(theta))).^(1.5).*cos(theta);
Jr=quad(funr,-phi1,phi1);
funa=@(beta)(1/(2*pi)).*(1-(0.5/epsi).*(1-cos(beta))).^(1.5);
Ja=quad(funa,-phi1,phi1);
ceq=real(Jr)*cosd(alpha)/(real(Ja)*sind(alpha))-Fr/Fa;
%c=[];
end
When I run this code, I am getting the optimized value of dr as [-0.0001, 0.0011]. This value is clearly beyond limiting values of dr. I am specifying lower bound of dr as [0,0]. I am unable to understand why Matlab is not considering specified boundaries. As well, my final answer is dependent on initial guess. If I change my initial guess then my final answer changes. Can somebody please help to resolve these issues??
Thanks in advance,
Nikhil
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!