How to convert a transfer function into state space representation?

260 vues (au cours des 30 derniers jours)
Hind Aljallaf
Hind Aljallaf le 1 Mai 2023
Modifié(e) : Paul le 2 Mai 2023
I was trying to convert a transfer function into state space representation, but the matrices in the output are not quiet correct. The numbers are flipped like how in B 0 should be up and 1 should be down, or in C where 2 should be right and 3 should be left. How can I fix this issue?

Réponses (2)

Walter Roberson
Walter Roberson le 1 Mai 2023
num = [0 3 2];
den = [1 4 4];
G = tf(num, den);
S = ss(G)
S = A = x1 x2 x1 -4 -2 x2 2 0 B = u1 x1 2 x2 0 C = x1 x2 y1 1.5 0.5 D = u1 y1 0 Continuous-time state-space model.
S.A
ans = 2×2
-4 -2 2 0
S.B
ans = 2×1
2 0
S.C
ans = 1×2
1.5000 0.5000
S.D
ans = 0
[A, B, C, D] = tf2ss(num, den)
A = 2×2
-4 -4 1 0
B = 2×1
1 0
C = 1×2
3 2
D = 0
At the moment I do not kow why the values do not match.

Paul
Paul le 1 Mai 2023
Modifié(e) : Paul le 2 Mai 2023
The state space realization of a transfer function is not unique. In fact, there are infinitely many state space realizations to choose from.
num = [0 3 2];
den = [1 4 4];
The Control System Toolbox uses one methodology
G = ss(tf(num, den))
G = A = x1 x2 x1 -4 -2 x2 2 0 B = u1 x1 2 x2 0 C = x1 x2 y1 1.5 0.5 D = u1 y1 0 Continuous-time state-space model.
and the Signal Processing Toolbox uses another
[A,B,C,D] = tf2ss(num,den)
A = 2×2
-4 -4 1 0
B = 2×1
1 0
C = 1×2
3 2
D = 0
Each realization has the same transfer function
tf(G)
ans = 3 s + 2 ------------- s^2 + 4 s + 4 Continuous-time transfer function.
[b,a] = ss2tf(A,B,C,D)
b = 1×3
0 3.0000 2.0000
a = 1×3
1 4 4
Any other realization can be obtained via similarity transformation. The CST provides a function ss2ss to do that
ss2ss(ss(A,B,C,D),[0 1;1 0])
ans = A = x1 x2 x1 0 1 x2 -4 -4 B = u1 x1 0 x2 1 C = x1 x2 y1 2 3 D = u1 y1 0 Continuous-time state-space model.
tf(ans)
ans = 3 s + 2 ------------- s^2 + 4 s + 4 Continuous-time transfer function.

Catégories

En savoir plus sur Dynamic System Models dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by