1
votes

I'm using MATLAB to get my steady state response for a system (Response of the states), the system has two states but MATLAB only plots 1 whatever I do.

Here's my code:

s=tf('s');
J=0.006;
Rm=1.5;
B=0.01;
Lm=15;
Kt=0.7;
Km=0.6;

A=[-Rm/Lm -Km/Lm;Kt/J -B/J];
B=[1/Lm;0];
C=[0 1];
D=[0];
sys=ss(A,B,C,D);    
T=tf(sys); 

[y,t] = step(T);

plot(t, y);
legend('x1', 'x2');

Output Plot:

Plot Output

1

1 Answers

2
votes

Per the documentation of step, the output vector y is the output response of the system (y = C*x + D*u) and not the state trajectories. The state trajectories are acquired via the third output of step. Also, in order for step to return the trajectories, the input must be a state-space (ss) model, but you're inputing the transfer function (tf) form of the system. From those two points, the following should provide your desired output:

[y,t,x] = step(sys);
plot(t, x);
legend('x1', 'x2');