Problem in conversion the state-space of the system to transfer function
7 views (last 30 days)
Show older comments
I want to return the state-space to transfer function, if the system reduced is by balanced real technique.
I have this code
s=tf('s');
G=(s^3+11*s^2+36*s+26)/(s^4+14.6*s^3+74.96*s^2+156.7*s+99.65);
[A,B,C,D]=ssdata(G);
[AA, BB, CC,DD] = balreal(A, B, C);
[b,a] = ss2tf(AA,BB,CC,DD);
if i want to convert state-space representation to transfer function using the function 'ss2tf', i find this error :
Error using ss2tf (line 26)
The C and D matrices must have the same number of rows.
Can any one help me how can i solve this error ?
0 Comments
Accepted Answer
Stephan
on 17 Sep 2018
Edited: Stephan
on 17 Sep 2018
Hi,
this appears to run:
s=tf('s');
G=(s^3+11*s^2+36*s+26)/(s^4+14.6*s^3+74.96*s^2+156.7*s+99.65);
[sys,g] = balreal(G);
[b,a] = ss2tf(sys.A, sys.B, sys.C, sys.D);
result is:
>> transfun = tf(a,b)
transfun =
s^4 + 14.6 s^3 + 74.96 s^2 + 156.7 s + 99.65
--------------------------------------------
s^3 + 11 s^2 + 36 s + 26
Continuous-time transfer function.
Best regards
Stephan
2 Comments
Stephan
on 17 Sep 2018
Edited: Stephan
on 17 Sep 2018
Hi,
s=tf('s');
G=(s^3+11*s^2+36*s+26)/(s^4+14.6*s^3+74.96*s^2+156.7*s+99.65);
[sys,g] = balreal(G);
elim = g < 10e-4;
rsys = modred(sys,elim);
[b, a] = ss2tf(rsys.A, rsys.B, rsys.C, rsys.D);
transfun = tf(b,a);
You can control the order of the resulting system with the bound you set on elim variable by:
elim = g < 10e-4;
Before reduction g is:
g =
0.1374
0.0069
0.0003
0.0002
If elim has 2 entries after setting the bound by using:
elim = g < 10e-4;
elim =
4×1 logical array
0
0
1
1
then your resulting system has order 2:
transfun =
-0.0001171 s^2 + 0.9978 s + 1.119
---------------------------------
s^2 + 4.634 s + 4.288
If you change the value for g to a bigger value:
elim = g < 10e-3;
elim =
4×1 logical array
0
1
1
1
and your resulting system has order 1:
transfun =
-0.01389 s + 1.174
------------------
s + 4.498
Best regards
Stephan
More Answers (0)
See Also
Categories
Find more on Dynamic System Models 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!