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.
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 Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2021년 1월 24일

댓글:

2021년 1월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by