how to use multiple graphs such as insert step and step response in a graph as shown in image?

2 次查看(过去 30 天)
I am using this code
L=0:25;
T=[2 2.25 2.48 3.15 3.35 4.07 4.36 5.09 5.45 6.20 6.56 7.38 8.25 9.10 10.04 10.58 12.30 13.45 15.06 16.58 19.00 22.00 25.15 31.15 39.0 60.0];
plot(T,L);
grid;
Please suggest Regards MMS79

采纳的回答

Star Strider
Star Strider 2014-8-25
It looks as though your step input plot starts at the second value of your time vector and reached a value of 20 from there on, this works:
L=0:25;
T=[2 2.25 2.48 3.15 3.35 4.07 4.36 5.09 5.45 6.20 6.56 7.38 8.25 9.10 10.04 10.58 12.30 13.45 15.06 16.58 19.00 22.00 25.15 31.15 39.0 60.0];
S = [0 ones(1,size(L,2)-1)*20];
plot(T,L);
hold on
plot(T,S, '-k', 'LineWidth',2)
hold off
grid;
  2 个评论
mms79
mms79 2014-8-25
Thanks a lot, it work, I got exactly what required, only the thing is, now its origin is at 2, i require from 0. Regards mms79
Star Strider
Star Strider 2014-8-25
This seems to do what you want:
L=0:25;
T=[2 2.25 2.48 3.15 3.35 4.07 4.36 5.09 5.45 6.20 6.56 7.38 8.25 9.10 10.04 10.58 12.30 13.45 15.06 16.58 19.00 22.00 25.15 31.15 39.0 60.0];
ST = [0 linspace(0,60,size(T,2)-1)];
S = [0 ones(1,size(L,2)-1)*20];
plot(T,L);
hold on
plot(ST,S, '-k', 'LineWidth',2)
hold off
grid;

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by