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!


