1

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

% Aircraft Static Stability MATLAB Script

% Constants and Parameters


m = 1000; % Mass of the aircraft (kg)
g = 9.81; % Acceleration due to gravity (m/s^2)
rho = 1.225; % Air density (kg/m^3)
S = 20; % Reference area of the wing (m^2)
c_bar = 2; % Mean aerodynamic chord (m)
b = 10; % Wing span (m)
I_xx = 5000; % Moment of inertia about x-axis (kg*m^2)
I_yy = 5000; % Moment of inertia about y-axis (kg*m^2)
I_zz = 10000; % Moment of inertia about z-axis (kg*m^2)
I_xz = 0; % Cross moment of inertia (kg*m^2)

% Aerodynamic Coefficients
C_m0 = -0.02; % Pitching moment coefficient at zero angle of attack
C_m_alpha = -0.08; % Pitching moment coefficient per unit angle of attack
C_m_delta_e = -0.01; % Pitching moment coefficient per unit elevator deflection
C_m_ih = 0.1; % Pitching moment coefficient per unit incidence angle of the
horizontal stabilizer
C_l0 = 0.1; % Rolling moment coefficient at zero sideslip angle
C_l_alpha = 0.05; % Rolling moment coefficient per unit angle of attack
C_l_delta_a = 0.01; % Rolling moment coefficient per unit aileron deflection
C_l_delta_r = 0.02; % Rolling moment coefficient per unit rudder deflection
C_n0 = 0.05; % Yawing moment coefficient at zero sideslip angle
C_n_alpha = 0.08; % Yawing moment coefficient per unit angle of attack
C_n_delta_a = 0.02; % Yawing moment coefficient per unit aileron deflection
C_n_delta_r = 0.04; % Yawing moment coefficient per unit rudder deflection

% Angle of Attack Range


alpha = linspace(-10, 10, 100);

% Pitching Moment Coefficient (C_m) vs Angle of Attack (alpha)


C_m = C_m0 + C_m_alpha * alpha;

% Plotting C_m vs alpha


figure;
plot(alpha, C_m);
xlabel('Angle of Attack (deg)');
ylabel('Pitching Moment Coefficient (C_m)');
title('Pitching Moment Coefficient vs Angle of Attack');

% Stability Analysis
if C_m_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

% Lift Coefficient (C_L) vs Angle of Attack (alpha)


C_L = C_l0 + C_l_alpha * alpha;

% Plotting C_L vs alpha


figure;
plot(alpha, C_L);
xlabel('Angle of Attack (deg)');
ylabel('Lift Coefficient (C_L)');
title('Lift Coefficient vs Angle of Attack');
% Stability Analysis
if C_l_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

% Yawing Moment Coefficient (C_n) vs Angle of Attack (alpha)


C_n = C_n0 + C_n_alpha * alpha;

% Plotting C_n vs alpha


figure;
plot(alpha, C_n);
xlabel('Angle of Attack (deg)');
ylabel('Yawing Moment Coefficient (C_n)');
title('Yawing Moment Coefficient vs Angle of Attack');

% Stability Analysis
if C_n_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

% Drag Coefficient (C_D) vs Angle of Attack (alpha)


C_D = C_D0 + (C_L.^2) ./ (pi * e * AR);

% Plotting C_D vs alpha


figure;
plot(alpha, C_D);
xlabel('Angle of Attack (deg)');
ylabel('Drag Coefficient (C_D)');
title('Angle of Attack vs Drag Coefficient');

% Stability Analysis
if C_D_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

% Lift Coefficient (C_L) vs Drag Coefficient (C_D)


figure;
plot(C_D, C_L);
xlabel('Drag Coefficient (C_D)');
ylabel('Lift Coefficient (C_L)');
title('Drag Polar');

% Stability Analysis
if C_L_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

% Incidence Angle of the Horizontal Stabilizer Range


i_h = linspace(-50, 50, 100);

% Calculate Lift Coefficient (C_L) for different i_h values


C_L_total = C_L0_wf + C_L_alpha_wf * alpha + C_L_alpha_h * eta_h * S_h / S * (alpha
- (epsilon_0 + d_epsilon_d_alpha * alpha) + i_h + tau_e * delta_e) + eta_h * S_h /
S * C_L0_h;

% Plotting C_L vs alpha for different i_h values


figure;
for i = 1:length(i_h)
plot(alpha, C_L_total(:,i), 'DisplayName', ['i_h = ' num2str(i_h(i)) ' deg']);
hold on;
end
hold off;
xlabel('Angle of Attack (deg)');
ylabel('Lift Coefficient (C_L)');
title('Lift Coefficient vs Angle of Attack for Different i_h');
legend('show');

% Stability Analysis
if C_L_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

% Aerodynamic Pitching Moment Coefficient (C_m) vs Angle of Attack (alpha)


C_m_AC_wf = C_m_AC_wf + (C_L0_wf + C_L_alpha_wf * alpha) * (x_bar_cg - x_bar_AC_wf)
- C_L_alpha_h * eta_h * V_bar_h * (x_bar_AC_h - x_bar_cg) * (alpha - (epsilon_0 +
d_epsilon_d_alpha * alpha) + i_h + tau_e * delta_e);
C_m_ih = -C_L_alpha_h * eta_h * V_bar_h;
C_m_delta_e = -C_L_alpha_h * eta_h * V_bar_h * tau_e;

% Plotting C_m vs alpha for different delta_e values


figure;
delta_e = linspace(-50, 50, 100);
for i = 1:length(delta_e)
C_m_total = C_m_AC_wf + C_m_delta_e * delta_e(i);
plot(alpha, C_m_total, 'DisplayName', ['delta_e = ' num2str(delta_e(i)) '
deg']);
hold on;
end
hold off;
xlabel('Angle of Attack (deg)');
ylabel('Pitching Moment Coefficient (C_m)');
title('Pitching Moment Coefficient vs Angle of Attack for Different delta_e');
legend('show');

if C_m_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

% Plotting C_m vs alpha for different i_h values


figure;
i_h = linspace(-50, 50, 100);
for i = 1:length(i_h)
C_m_total = C_m_AC_wf + C_m_ih * i_h(i);
plot(alpha, C_m_total, 'DisplayName', ['i_h = ' num2str(i_h(i)) ' deg']);
hold on;
end
hold off;
xlabel('Angle of Attack (deg)');
ylabel('Pitching Moment Coefficient (C_m)');
title('Pitching Moment Coefficient vs Angle of Attack for Different i_h');
legend('show');

% Stability Analysis
if C_m_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

% Estimation of Aircraft Aerodynamic Center (AC)


x_bar_AC = ((x_bar_AC_wf + C_L_alpha_h / C_L_alpha_wf * eta_h * V_bar_h *
x_bar_AC_h * (1 - d_epsilon_d_alpha)) / (1 + C_L_alpha_h / C_L_alpha_wf * eta_h *
V_bar_h * (1 - d_epsilon_d_alpha)));

disp(['Aircraft Aerodynamic Center (AC) is located at x_bar_AC = '


num2str(x_bar_AC)]);

% Thrust Forces and Moments


T = 5000; % Thrust force (N)
phi_T = 0; % Thrust angle (deg)

% Longitudinal Thrust Forces and Moments


F_Tx = T * cosd(phi_T + alpha_1);
F_Tz = -T * sind(phi_T + alpha_1);
M_T = -T * d_T;

% Body Axis Longitudinal Thrust Forces and Moments


F_Tx_b = T * cosd(phi_T);
F_Tz_b = -T * sind(phi_T);
M_T_b = -T * d_T;

% Plotting Effect of Changing C_m vs alpha at i_h = 0 and varying degrees of


delta_e
figure;
delta_e = linspace(-50, 50, 100);
for i = 1:length(delta_e)
C_m_total = C_m_AC_wf + C_m_delta_e * delta_e(i);
plot(alpha, C_m_total, 'DisplayName', ['delta_e = ' num2str(delta_e(i)) '
deg']);
hold on;
end
hold off;
xlabel('Angle of Attack (deg)');
ylabel('Pitching Moment Coefficient (C_m)');
title('Effect of Changing C_m vs Angle of Attack at i_h = 0 and Varying delta_e');
legend('show');

% Stability Analysis
if C_m_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

% Plotting Effect of Changing C_m vs alpha at delta_e = 0 and varying degrees of


i_h
figure;
i_h = linspace(-50, 50, 100);
for i = 1:length(i_h)
C_m_total = C_m_AC_wf + C_m_ih * i_h(i);
plot(alpha, C_m_total, 'DisplayName', ['i_h = ' num2str(i_h(i)) ' deg']);
hold on;
end
hold off;
xlabel('Angle of Attack (deg)');
ylabel('Pitching Moment Coefficient (C_m)');
title('Effect of Changing C_m vs Angle of Attack at delta_e = 0 and Varying i_h');
legend('show');

% Stability Analysis
if C_m_alpha < 0
disp('The system is statically stable.');
else
disp('The system is not statically stable.');
end

You might also like