Longitudinal Flight Linearization. Code doesn't return any results. Why?

function aircraft()
%Definition of the characteristics of the airship
Tmax=40000; %Maximum thrust Newtons
epst=0;
h=10^-6;
Iy=184214;
m=17327;
s=50.399;
corda=3.331;
ro=1.225;
g=9.81;
Cl_0=0.737;
Cd_0=0.095;
Cm_0=0;
Cl_alfa=5;
Cl_q=0;
Cl_deltae=0.4;
Cd_alfa=0.75;
Cd_q=0;
Cd_deltae=0;
Cm_alfa=-0.8;
Cm_q=-8;
Cm_deltae=-0.81;
deltae=0.01;
deltat=0.7;
V=0.2*347;
end
function mai()
%Call aircraft characteristics
aircraft();
%Stae and control vectors definition
state=[V 0 0 0]';
control=[0.7 0.01]';
%Jacobiano matrices call
[A,B]=jacobiano(state,control)
end
function [A,B]=jacobiano(x,uc)
%Definition of identity matrix 4x4
Mix=[];
for t=1:1:4
Mix(t,t)=1;
end
h=10^(-6);
%Definition of identity matrix 2x2
Miuc=[];
for t=1:1:2
Miuc(t,t)=1;
end
%Matrix A compute
for i=1:4
k=Mix(:,i);
A(:,k)=(FlightMode(x+h*k,uc)-FlightMode(x-h*k,uc))/(2*h);
end
%Matrix B compute
for j=1:2
w=Miuc(:,j);
B(:,w)=(FlightMode(x,uc+h*w)-FlightMode(x,uc-h*w))/(2*h);
end
end
function dx=FlightMode(x,uc)
%Call the characteristics of the aircraft
aircraft();
%%%%%%%%%%%%
u=x(1);
w=x(2);
q=x(3);
theta=x(4);
deltat=uc(1);
deltae=uc(2);
alfa=atan(w/u);
dalfa=0;
Cl=Cl_0+Cl_alfa*alfa+(corda/2*V)*(Cl_alfa*dalfa+Cl_q*q)+Cl_deltae*deltae;
Cd=Cd_0+Cd_alfa*alfa+(corda/2*V)*(Cd_alfa*dalfa+Cd_q*q)+Cd_deltae*deltae;
Cm=Cm_0+Cm_alfa*alfa+(corda/2*V)*(Cm_alfa*dalfa+Cm_q*q)+Cm_deltae*deltae;
dx(1)=(m^-1)*(0.5*ro*s*u^2*(1+tan(alfa)^2)*(Cl*sin(alfa)-Cd*cos(alfa))+deltat*Tmax*cos(epst))-g*sin(theta)-q*w;
dx(2)=(m^-1)*(deltat*Tmax*sin(epst)-0.5*ro*s*u^2*(1+tan(alfa)^2)*(Cd*sin(alfa)+Cl*cos(alfa)))+g*cos(theta)+q*u;
dx(3)=(ro*u^2*(1+tan(alfa)^2)*s*corda*Cm)/2*Iy;
dx(4)=q;
dx=dx';
end
Longitudinal Flight Linearization. Code doesn't return any results. Why?

답변 (1개)

What you have marked as "function aircraft" needs to be turned into a script in a different file than the other functions.
It appears to me that once that was done you would need to invoke mai . However I note that mai does not return any results, so you probably want to change
function mai()
to
function [A, B] = mai()

카테고리

도움말 센터File Exchange에서 Fluid Mechanics에 대해 자세히 알아보기

질문:

2016년 11월 14일

답변:

2016년 11월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by