ro=10;
ri=30;
t=0:0.1:2000;
ci=0.5
c_L=(ci*ri)/ro.*(1-exp(1).^((-ro.*t./((ri-ro).*t+1500))));
plot(t,c_L)
hold on
ro=15;
ri=25;
c_L=(ci*ri)/ro.*(1-exp(1).^((-ro.*t./((ri-ro).*t+1500))));
plot(t,c_L)
ro=25;
ri=15;
c_L=(ci*ri)/ro.*(1-exp(1).^((-ro.*t./((ri-ro).*t+1500))));
plot(t,c_L)
For the interval t it should be 0 to 2000, but when I run MATLAB with that interval graph looks very weired
However, with interval 0 to 100 looks fine.
What should I do?

 採用された回答

Star Strider
Star Strider 2021 年 1 月 24 日

0 投票

The ‘t’ vector for the first series of curves is:
t=0:0.1:100;
and for the second:
t=0:0.1:2000;
That likely explains the difference.
To plot ‘t’ from 0 to 2000, define ‘t’ over the desired range.

6 件のコメント

Jong Hyun Lee
Jong Hyun Lee 2021 年 1 月 24 日
My question was for first series t interval should be 0 to 2000 but when I run it (with 0 to 2000) graph looks very weired. But with interval 0 to 100 looks fine.
Star Strider
Star Strider 2021 年 1 月 24 日
The problem is in the third plot of your original (unedited Question — I saved the previous code), specifically:
ro=25;
ri=15;
c_L=(ci*ri)/ro.*(1-exp((-ro.*t./((ri-ro).*t+1500))));
plot(t,c_L)
In the previous plots, (ro < ri) so the difference (ri-ro) was positive and the code gave you the result you want. With (ro > ri), the exponent becomes positive, and when ‘t’ is 150.6, ‘c_L’ is . I have no idea what you are calculating here, however so long as you should get the sort of result you want.
Jong Hyun Lee
Jong Hyun Lee 2021 年 1 月 25 日
that means i cant draw graph for ro>ri?
Star Strider
Star Strider 2021 年 1 月 25 日
You certainly can draw it. You just need to be prepared for results that may not be what you want. Or alternatively, use ylim to restrict the display to only positive values of ‘c_L’.
Jong Hyun Lee
Jong Hyun Lee 2021 年 1 月 25 日
i see, thanks!
Star Strider
Star Strider 2021 年 1 月 25 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-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