PlotOptions and Legend for Step Response

조회 수: 42 (최근 30일)
Shilp Dixit
Shilp Dixit 2013년 11월 27일
편집: Azzi Abdelmalek 2013년 11월 27일
Hi, I am facing a small issue with formatting my step response plots.
I have a state space description with
2 states, 1 input, 3 outputs
A = 2X2 matrix
B = 2X1 matrix
C = 3X2 matrix
D = 3X1 matrix
I have five different values of inputs. 3, 20, 30, 40, 60 and want to plot a single step response to compare the responses. To find a way around this i created
A as a 2X2X5 matrix and
C as a 3X2X5 matrix and then use the following functions.
sys = ss(A,B,C,D)
tf_sys = tf(sys)
When i use step(tf_sys). I am getting the correct step responses but all are of the same color and there is no legend. How can I modify plot style and enable legend for such a plot.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 27일
편집: Azzi Abdelmalek 2013년 11월 27일
You can create your own plot and legend
A=[-11 -10;1 0];
B=[1;0];
C=eye(2);
D=[0;0];
sys=ss(A,B,C,D)
[x,t]=step(sys)
plot(t,x)
legend({'c1','c2'})

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by