Hello Matlabers!
I'm using fsolve function for optimization of system of ODE. And I'm facing difficulty now. Could someone advise me with this please? I'm just beginner in using Matlab and I do appreciate your advise.
The functions file is expressed below.
------------------------------------------------------
STAT=importdata('STAT.txt');
Theda_izr=deg2rad(Theda_iz);
Gamma_izr=deg2rad(Gamma_iz);
Alpha_izr=deg2rad(Alpha_iz);
Beta_izr=deg2rad(Beta_iz);
ax=g*(nx(i)-sin(Theda(i)));
ay=g*(ny(i)-cos(Theda(i))*cos(Gamma(i)));
az=g*(nz(i)+cos(Theda(i))*sin(Gamma(i)));
Theda(i+1)=Theda(i)+dt*(((Wy_r(i)*Ery*sin(Gamma(i)))+(Wz_r(i)*Erz*cos(Gamma(i)))));
Gamma(i+1)=Gamma(i)+dt*((Wx_r(i)*Erx-(tan (Theda(i))*(Wy_r(i)*Ery*cos(Gamma(i))-Wz_r(i)*Erz*sin(Gamma(i))))));
Alpha(i+1)= Alpha(i)+ dt*( Wz_r(i)*Erz-csBinv*Erv(ssA*(axv-Wy_r(i)*Ery*ssB)+csA*(ayv+Wx_r(i)*Erx*ssB)) );
Beta(i+1)=Beta(i)+dt*( azv*csB-csA*(axv*Erv*ssB-Wy_r(i))+ssA*(ayv*ssB+Wx_r(i)*Erx) );
V(i+1)=V(i)+dt*(ax*csA*csB-ay*Erw*ssA*csB+az*ssB );
The optimization file is expressed below.
-------------------------------------------------------
zg=input('Enter initial guess');
options=optimoptions('fsolve','Algorithm','levenberg-marquardt');
[X,fval,exitflag,output,hessian] =fsolve(@SimFnc,zg,options)
2 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/723008-optimization-of-system-ode#comment_1276998
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/723008-optimization-of-system-ode#comment_1276998
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/723008-optimization-of-system-ode#comment_1277233
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/723008-optimization-of-system-ode#comment_1277233
Sign in to comment.