hi i need to use this function in interpreted matlab function block in simulink and i need to take output from it whenever i tried it is showing some error(undefined function)

1 view (last 30 days)
function y = beginflight()
u0=[10;20;30];
y=fsolve(@trimalgorithm,u0);
end
function eqn= trimalgorithm(u)
V=10;
rho=1.225;
CD=0.08712-(0.05593*u(1))+(3.4825*u(1)^2)+(0.2258*u(2)^2)+(0.1471*u(2));
CL=0.1748+(2.453*u(1))-(1.691*u(1)^2)+(29.986*u(1)^3)-(49.245*u(1)^4)-(0.3638*u(2)^2)+(0.7405*u(2));
Jad=V/(u(3)*0.1);
qdyn=0.5*rho*V^2;
I=4/(pi*pi)*rho^2*u(3)^2*0.1^4;
T=I*(-0.0948*Jad^2+0.058*Jad+0.0761);
eqn(1)= -CD*qdyn*0.0618+T*cos(u(1));
eqn(2) = -CL*qdyn*0.0618+T*sin(u(1))+2.943;
eqn(3) = 0.0385-(0.59977*u(1))-(1.27402*u(1)^2)-(0.1587*u(2)^2)-(0.4106*u(2));
end

Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!