Why does the for loop give wrong answer
古いコメントを表示
Hello, I am trying to do a few operations with data in order to make some graphs for my report. During our lab we took some readings and now need to calculate the pressure coefficient for higher and lower surface with different angles of attack. Where did i make an error, since the matlab does not calculate it properly. This is formula I used. C_p = (local_pressure - ambient_pressure)/0.5*rho*V^2
In matlab I used this for command
the answer for 1st pressure should be about about -2.5 yet matlab gives the answer -3.0646e+05
Could someone tell mem where I made the mistake?
I attached my workspace above.
for i = 1:10
C_p_l_10(i) = (1000*lower_pressure(1,i)-ambient_pressure(1))/0.5*ambient_air_density*velocity(1)^2
end
2 件のコメント
Muhammad Usman
2019 年 11 月 17 日
As you mentioned in your formula, there is no multiplication with 1000, but if you want to scale down your result then you multiply 1E-05 and your code look like:
for i = 1:10
C_p_l_10(i) = 1e-05*(lower_pressure(1,i)-ambient_pressure(1))/0.5*ambient_air_density*velocity(1)^2;
end
C_p_l_10
simply display tour values outside loop
czakar
2019 年 11 月 17 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


