Can someone tell me why my graph isn't plotting?

12 ビュー (過去 30 日間)
Kane Patrick Bobier
Kane Patrick Bobier 2020 年 10 月 23 日
コメント済み: Star Strider 2020 年 10 月 23 日
I am trying to plot Coefficient of Drag (Cd) and Coefficient of Lift (Cl) vs. Angle of Attack (a). The code doesn't have any errors but nothing is boing plotted. My for loop produces the Cd and Cl values that I need. Can someone check my code?
%area
A = 0.152 * 0.3;
a = 0:5:50;
Pd = [
0.65,
0.65,
0.64,
0.59,
0.55,
0.53,
0.49,
0.43,
0.38,
0.33,
0.26
];
Fl = [
-17.23,
-4.6,
6.25,
13.37,
12.54,
13.82,
17.24,
19.51,
21.88,
22.83,
19.56
];
Fd = [
5.07,
5.41,
6.79,
10.23,
12.42,
16.46,
19.69,
23.38,
27.1,
30.02,
3.35
];
for i = 1:numel(Pd)
Cl = (Fl(i)/(Pd(i)*A))
Cd = (Fd(i)/(Pd(i)*A))
end
plot(a, Cl);
hold on;
grid on;
plot(a, Cd);
hold on;
grid on;
xlabel('a - Angle of Attack');
ylabel('Cl-(Coefficient of Lift) and Cd-(Coefficicent of Drag)');
title('Coefficients of Lift and Drag vs. Angle of Attack');

採用された回答

Star Strider
Star Strider 2020 年 10 月 23 日
Subscript ‘Cl’ and ‘Cd’ in the loop:
Cl(i) = (Fl(i)/(Pd(i)*A))
Cd(i) = (Fd(i)/(Pd(i)*A))
.
  2 件のコメント
Kane Patrick Bobier
Kane Patrick Bobier 2020 年 10 月 23 日
Thank you! Works perfect.
Star Strider
Star Strider 2020 年 10 月 23 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by