r=1.1;c=1.2;po=80.;qo=700.;
rqo=r*qo;rc=r*c;
t1=linspace(0.,0.2,10);
t2=linspace(0.2,0.8,10);
p1=(qo/c*((rc*exp(t1/rc)-rc)-5.0.*...
(t1*rc.*exp(t1/rc)-rc^2.0*(exp(t1/rc-1.)))+po).*exp(-t1/rc))
p2=(qo/c*((rc*exp(0.2/rc)-rc)-5.0.*...
(0.2*rc.*exp(0.2/rc)-rc^2.0*(exp(0.2/rc-1.)))+po).*exp(-t2/rc))
figure(1);
plot(t1,p1,t2,p2);
ylabel('Pressure (mmHg)'); xlabel('Time (s)');
axis([0 0.8 1 130]);

回答 (2 件)

Adam Danz
Adam Danz 2020 年 11 月 17 日
編集済み: Adam Danz 2020 年 11 月 17 日

0 投票

The code works well if you remove the last line. Note that y-limit of your plot is 25000-50000. The last line of your code is setting the ylim to [1,130] which doesn't show any of the data.
Perhaps you're looking for
axis tight
r=1.1;
c=1.2;
po=80.;
qo=700.;
rqo=r*qo;
rc=r*c;
t1=linspace(0.,0.2,10);
t2=linspace(0.2,0.8,10);
p1=(qo/c*((rc*exp(t1/rc)-rc)-5.0.*...
(t1*rc.*exp(t1/rc)-rc^2.0*(exp(t1/rc-1.)))+po).*exp(-t1/rc));
p2=(qo/c*((rc*exp(0.2/rc)-rc)-5.0.*...
(0.2*rc.*exp(0.2/rc)-rc^2.0*(exp(0.2/rc-1.)))+po).*exp(-t2/rc));
figure(1);
plot(t1,p1,t2,p2);
ylabel('Pressure (mmHg)'); xlabel('Time (s)');
●
ylim(gca)
ans = 1×2
25000 50000

2 件のコメント

ALEX MC QUAID
ALEX MC QUAID 2020 年 11 月 17 日
the pressure values are supposed to be between 1 and 130 does this mean my calculations are wrong?
Adam Danz
Adam Danz 2020 年 11 月 17 日
編集済み: Adam Danz 2020 年 11 月 17 日
Yes, unless the difference can be explained by a unit-conversion.

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

Setsuna Yuuki.
Setsuna Yuuki. 2020 年 11 月 17 日
編集済み: Setsuna Yuuki. 2020 年 11 月 17 日

0 投票

you should change the last line
r=1.1;c=1.2;po=80.;qo=700.;
rqo=r*qo;rc=r*c;
t1=linspace(0.,0.2,10);
t2=linspace(0.2,0.8,10);
p1=(qo/c*((rc*exp(t1/rc)-rc)-5.0.*...
(t1*rc.*exp(t1/rc)-rc^2.0*(exp(t1/rc-1.)))+po).*exp(-t1/rc))
p2=(qo/c*((rc*exp(0.2/rc)-rc)-5.0.*...
(0.2*rc.*exp(0.2/rc)-rc^2.0*(exp(0.2/rc-1.)))+po).*exp(-t2/rc))
figure
plot(t1,p1,t2,p2);
ylabel('Pressure (mmHg)'); xlabel('Time (s)');
axis([0 0.8 1 50000]); % before: axis([0 0.8 1 130]);

カテゴリ

ヘルプ センター および File Exchange で Contour Plots についてさらに検索

製品

リリース

R2020b

タグ

質問済み:

2020 年 11 月 17 日

編集済み:

2020 年 11 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by