I have issues calculating lift coefficient (CL), drag coefficient (CD), and thrust (T)

7 views (last 30 days)
Hello everyone,
I am having some issues with my MATLAB code for calculating lift coefficient (CL), drag coefficient (CD), and thrust (T). The values I am getting are not close to the ones that my professor calculated by hand for CL (0.76 0.74 0.69 0.61 0.54 0.49 0.47 0.49 0.54 0.61 0.69 0.74 0.76), and I am not sure where the issue might be. Additionally, the graphs for CL, CD, and T do not look like they should. I have included my code below for reference. Can anyone help me figure out what might be causing the discrepancies?
clc;
clear;
close all;
syms CL CD T CDzero K gamma V R g m rho S
V = 202;
R = 1000;
g = 9.8;
rho = 1.058;
S = 24;
m = 7800;
gamma = [0 30 60 90 120 150 180 210 240 270 300 330 360];
%Initialize vectors for CL, CD, and T
CL_vector = zeros(size(gamma));
CD_vector = zeros(size(gamma));
T_vector = zeros(size(gamma));
%Calculate CL, CD, and T for each gamma value
for i = 1:length(gamma)
%Calculate CL
CL = (2*cosd(gamma(i)) + (V^2/(R*g))*m*g)/(rho*V^2*S);
CL_vector(i) = CL;
%Calculate CD
CDzero = 0.02;
K = 0.05;
CD = CDzero + K*CL^2;
CD_vector(i) = CD;
%Calculate T
T = m*g*sin(gamma(i)) + (rho*V^2*S*CD)/2;
T_vector(i) = T;
end
%Plot graphs
figure;
plot(gamma,CL_vector);
xlabel('gamma');
ylabel('CL');
grid on;
figure;
plot(gamma,CD_vector);
xlabel('gamma');
ylabel('CD');
grid on;
figure;
plot(gamma,T_vector);
xlabel('gamma');
ylabel('T');
grid on;
disp(CL_vector)
0.3072 0.3072 0.3072 0.3072 0.3072 0.3072 0.3072 0.3072 0.3072 0.3072 0.3072 0.3072 0.3072
Thank you in advance!

Accepted Answer

VBBV
VBBV on 16 Feb 2023
clc;
clear;
close all;
% syms CL CD T CDzero K gamma V R g m rho S
V = 202;
R = 1000;
g = 9.8;
rho = 1.058;
S = 24;
m = 7800;
gamma = [0 30 60 90 120 150 180 210 240 270 300 330 360];
CDzero = 0.02;
K = 0.05;
%Initialize vectors for CL, CD, and T
CL_vector = zeros(size(gamma));
CD_vector = zeros(size(gamma));
T_vector = zeros(size(gamma));
%Calculate CL, CD, and T for each gamma value
for i = 1:length(gamma)
%Calculate CL
CL = 2*(m*g*cosd(gamma(i)) + (m*V^2/(R*g))*g)/(rho*V^2*S);
CL_vector(i) = CL;
%Calculate CD
CD = CDzero + K*CL^2;
CD_vector(i) = CD;
%Calculate T
T = m*g*sind(gamma(i)) + (rho*V^2*S*CD)/2;
T_vector(i) = T;
end
%Plot graphs
figure;
plot(gamma,CL_vector);
xlabel('gamma');
ylabel('CL');
grid on;
figure;
plot(gamma,CD_vector);
xlabel('gamma');
ylabel('CD');
grid on;
figure;
plot(gamma,T_vector);
xlabel('gamma');
ylabel('T');
grid on;
disp(CL_vector)
0.7619 0.7422 0.6881 0.6144 0.5406 0.4866 0.4668 0.4866 0.5406 0.6144 0.6881 0.7422 0.7619
  4 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Networks in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!