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?

 Respuesta aceptada

Star Strider
Star Strider el 24 de En. de 2021
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 comentarios

Jong Hyun Lee
Jong Hyun Lee el 24 de En. de 2021
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 el 25 de En. de 2021
that means i cant draw graph for ro>ri?
Star Strider
Star Strider el 25 de En. de 2021
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 el 25 de En. de 2021
i see, thanks!
Star Strider
Star Strider el 25 de En. de 2021
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 24 de En. de 2021

Comentada:

el 25 de En. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by