Professional Documents
Culture Documents
clear all
% Flight Parameters
c = 3.159 ;
S = 64.0;
rho = 1.225;
m = 19638.23;
AR = 7.22;
H = 2400;
Th = 2000;
g = 9.81;
e = 0.9112;
s = 10.775;
%
%
%
%
%
%
u = 296;
v = 0;
w = 0;
p = 0;
q = 0;
r = 0;
phi = 0;
theta = 0;
psi = 0;
alpha = 0;
beta = 0;
t = 0;
h = 0.01; % Time step for Longitudunal Motion
h1 = 0.01; % Time step for Lateral Motion
fid = fopen('sixdof_sim.txt','w'); % Opening the file in writable mode
while t <=
K(1) =
L(1) =
M(1) =
N(1) =
O(1) =
P(1) =
Q(1) =
R(1) =
U(1) =
T(1) =
for i = 1 : 4
if i <= 3
K(1)= K(i)/2;
L(1)= L(i)/2;
M(1)= M(i)/2;
N(1)= N(i)/2;
O(1)= O(i)/2;
P(1)= P(i)/2;
Q(1)= Q(i)/2;
R(1)= R(i)/2;
U(1)= U(i)/2;
T(1)= T(i)/2;
else
K(1)= K(i);
L(1)= L(i);
M(1)= M(i);
N(1)= N(i);
O(1)= O(i);
P(1)= P(i);
Q(1)= Q(i);
R(1)= R(i);
U(1)= U(i);
T(1)= T(i);
end % (end of for loop)
if t <=
de
da
dr
3
= 0*pi/180;
= 0*pi/180;
= 7*pi/180;
elseif
de
da
dr
elseif
de
da
dr
else
de
da
dr
end
u = u
v = v
w = w
phi =
theta
psi =
p = p
q = q
r = r
H = H
t
=
=
=
t
=
=
=
<= 5
0*pi/180;
0*pi/180;
-7*pi/180;
<=6
0*pi/180;
0*pi/180;
7*pi/180;
= 0*pi/180;
= 0*pi/180;
= -7*pi/180;
+ K(1);
+ L(1);
+ M(1);
phi + N(1);
= theta + O(1);
psi + P(1);
+ Q(1);
+ R(1);
+ U(1);
+ T(1);
=
=
=
=
=
=
=
=
+ CLde*de;
+
+
+
+
Cmde*de;
Cyb*beta + Cyda*da + Cydr*dr;
Clb*beta + Clda*da + Cldr*dr;
Cnb*beta + Cnda*da + Cndr*dr;
p
q
r
H
=
=
=
=
p
q
r
H
+
+
+
+
(Q(2)
(R(2)
(U(2)
(T(2)
+
+
+
+
(Q(3)
(R(3)
(U(3)
(T(3)
+
+
+
+
Q(4))*2
R(4))*2
U(4))*2
T(4))*2
+
+
+
+
Q(5))
R(5))
U(5))
T(5))
/
/
/
/
6;
6;
6;
6;
fprintf(fid, '%6.9f %6.9f %6.9f %6.9f %6.9f %6.9f %6.9f %6.9f %6.9f %6.9f %6
.9f %6.9f %6.9f %6.9f %6.9f %6.9f\n', t,alpha,beta,u,v,w,phi,theta,psi,p,q,r,H,d
e,da,dr);
t = t + h;
end
status = fclose(fid);
AA = load('sixdof_sim.txt');
figure(1)
subplot(4,1,1);
plot(AA(:,1),AA(:,3));
title('Lateral Directional Motion Simulation (Three DOF Model)');
ylabel ('\beta , rad');
hold on
subplot(4,1,2);
plot(AA(:,1),AA(:,10));
ylabel ('p , rad/s');
hold on
subplot(4,1,3);
plot(AA(:,1),AA(:,12));
ylabel ('r , rad/s');
hold on
subplot(4,1,4);
plot(AA(:,1),AA(:,15));
ylabel ('\delta_a , rad');
xlabel('Time , sec');
hold off
figure(2)
subplot(4,1,1);
plot(AA(:,1),AA(:,3));
title('Lateral Directional Motion Simulation (Three DOF Model)');
ylabel ('\beta , rad');
hold on
subplot(4,1,2);
plot(AA(:,1),AA(:,10));
ylabel ('p , rad/s');
hold on
subplot(4,1,3);
plot(AA(:,1),AA(:,12));
ylabel ('r , rad/s');
hold on
subplot(4,1,4);
plot(AA(:,1),AA(:,16));
xlabel('Time , sec');
ylabel ('\delta_r , rad');
hold off
%
%
%
%
figure(3)
subplot(3,1,1)
plot(AA(:,1),AA(:,2))
title('Longitudinal Motion Simulation ( Three DOF Model)');
%
%
%
%
%
%
%
%
%
%
%
%
%
ylabel('\alpha')
hold on
subplot(3,1,2)
plot(AA(:,1),AA(:,11))
ylabel('q , rad/s')
hold on
subplot(3,1,3)
plot(AA(:,1),AA(:,14))
xlabel('Time , sec.')
ylabel('\delta_e, rad')
hold off