ODE to solve for density
이전 댓글 표시
Hi,
I'm currently trying to calculate air density which involves solving an ODE for altitude. I have plotted a graph for it, I get the right shape but the axis and numbers are wrong. The first figure is what I get for my output, whereas the second is the correct one (using the line vector). Can anybody help me? Much appreciated


[h,p]=ode45(@p_prime,[0 7.5],0);
plot(p,h)
ylabel('Altitude (km)')
xlabel('Air density (kg/m^3)')
function dp=p_prime(h,p)
p0=1.225
hscale=7.5
dp=(p0*exp(-h/hscale))
end
채택된 답변
추가 답변 (1개)
Bjorn Gustavsson
2021년 3월 2일
1 개 추천
Your ODE is not correct for the pressure-variation. What you have in the p_prime function is closer to the solution of the pressure-balance. If you go back to the book you'll see something like this:

That is what you should have in the p_prime-function that you then integrate with altitude.
카테고리
도움말 센터 및 File Exchange에서 Gravitation, Cosmology & Astrophysics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
