Why is the set of numbers p2 not showing up on my graph

조회 수: 1 (최근 30일)
Diego
Diego 2024년 9월 20일
편집: Alan Stevens 2024년 9월 21일
  댓글 수: 1
dpb
dpb 2024년 9월 20일
편집: dpb 2024년 9월 20일
Quite possible the values are nan from the looks of the equations, but since you posted as an image instead of text, it would take retyping everything over to do anything specific.
Try
figure
semilogx(h,p1)
yyaxis right
semilogx(h,p2)
and you'll see the value for p2 is quite small and goes to zero quickly.
[min(p2) max(p2)]

댓글을 달려면 로그인하십시오.

답변 (1개)

Alan Stevens
Alan Stevens 2024년 9월 21일
편집: Alan Stevens 2024년 9월 21일
Should it be more like this? (Though I don't recognize the value you have for the gas constant; and temperature would normally be in K, whereas yours looks like C - perhaps 250K is appropriate for high up in the atmosphere. However, you haven't supplied the units, so it's difficult to tell!).
G0 = 9.80665;
R = 287.053; % ?
p0 = 101325;
RE = 6371000;
T = 250; % ?
h = linspace(0,100);
p1 = p0*exp(-G0*h*1000./(R*T));
p2 = p0*exp(-G0*RE*RE*h*1000./(RE + h*1000).^2/(R*T));
semilogx(p1,h,p2,h), grid
xlabel('pressure (pa)')
ylabel('altitude [km)')
legend('constant gravity','variable gravity')

카테고리

Help CenterFile Exchange에서 2-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