How can I obtain the matrices A, B, C ,D of the state space for a transfer matrix using Matlab?

Suppose I have a transfer matrix:
xa.PNG
how can I obtain the matrices A, B, C ,D of the state space for this matrix using Matlab?

 Accepted Answer

Try this:
s = tf('s');
P = [2/(s^2+3*s+2) 2*s/(s^2+3*s+2); -2*s/(s^2+3*s+2) -2/(s^2+3*s+2)]
S = ss(P)
producing:
S =
A =
x1 x2 x3 x4
x1 -3 -2 0 0
x2 1 0 0 0
x3 0 0 -3 -2
x4 0 0 1 0
B =
u1 u2
x1 2 0
x2 0 0
x3 0 2
x4 0 0
C =
x1 x2 x3 x4
y1 0 1 1 0
y2 -1 0 0 -1
D =
u1 u2
y1 0 0
y2 0 0
Continuous-time state-space model.

4 Comments

Thanks for answering. Is there a way of doing somehing like:
[A,B,C,D] = ss(P)
so that then I can use these matrices?
Thanks in advance.
My pleasure.
The ‘S’ variable is a structure. (See: Access Data in Structure Array for details.)
To get them as arrays:
A = S.A
B = S.B
C = S.C
D = S.D
producing:
A =
-3 -2 0 0
1 0 0 0
0 0 -3 -2
0 0 1 0
B =
2 0
0 0
0 2
0 0
C =
0 1 1 0
-1 0 0 -1
D =
0 0
0 0
All of these are double-precision arrays.
Thank you again. I am trying to apply this to solve this problem :
I don't know if it is ok to ask here, but could you give it a check if it is not a problem? Thanks in advance.
As always, my pleasure!
I posted an Answer to your other Question (that you referenced in your last Comment) that reproduces the anslysis at the end of that monograph. The appropriate MATLAB code is already written, so that was straightforward. (I have not done anything with Rosenbrock System Matrices since my multivariable control course in graduate school, so this was an interesting problem.)

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!