State space representation
Visual Cue | Narration |
---|---|
Show first slide |
Now we see how to represent a system in state space. We use the following A, B, C, D parameters: |
A = [0, 1; -1, -0.5] B = [0; 1] C = [1, 0] D = [0] |
We must define the initial state of the system. In order to show the true utility of this method, we choose a non-zero initial state; let it be 1: |
x0=[1; 0] |
We formally define the system with the above parameters as follows using the same 'syslin' function we used earlier: |
SSsys = syslin('c', A, B, C, D, x0) |
We simulate this system for 50 seconds: |
t = [0: 0.1: 50]; |
However, since the initial state of the system is at 1, we choose a step of 0.5: |
u = 0.5*ones(1, length(t)); |
We simulate the system: |
[y,x] = csim(u, t, SSsys); |
We plot the output: |
scf(1); plot(t, y) |
We can also plot the internal state of the system: |
scf(2); plot(t, x) |
We can view the root locus of this sytem: |
evans(SSsys) //zoom in |
For a more intuitive view of this system, we can convert this system from state space to its transfer function representation using the ss2tf function: |
ss2tf(SSsys) |
To verify that this is indeed the same system, we compare the roots of this transfer function to the eigenvalues of the system matrix: |
roots(denom(ans)) spec(A) |
END |