Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Convert state-space representation to transfer function

Status
Not open for further replies.

Sandi2000

Junior Member level 2
Joined
Aug 3, 2018
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
178
I worked on this code

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 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 ?
 

It seems you don't read documents at all.
Why don't you read documents surely ?
This is also true for https://www.edaboard.com/showthread.php?379888

Can any one help me how can i solve this error ?
Simply you don't read documents at all.
Then you can not understand "balreal()" at all.
That's all.

Code:
close all, clear all, clc
set(0, 'language', 'english')
colordef white; % Specify the plot background to be white

s = tf('s');

sys = (s^3+11*s^2+36*s+26) / (s^4+14.6*s^3+74.96*s^2+156.7*s+99.65)

[sysb, g] = balreal(sys);

tf(sysb)
g.'

sysr1 = tf( modred(sysb, [4], 'del') )
sysr2 = tf( modred(sysb, [3 4], 'del') )
sysr3 = tf( modred(sysb, [2 3 4], 'del') )

bode(sys,'r', sysr1,'g', sysr2,'b', sysr3,'k')
grid on
legend('sys', 'sysr1', 'sysr2', 'sysr3')

set(gcf, 'numbertitle', 'off')
set(gcf, 'MenuBar', 'none')

colordef black; % Specify the plot background to be black

Code:
Transfer function:
          s^3 + 11 s^2 + 36 s + 26
--------------------------------------------
s^4 + 14.6 s^3 + 74.96 s^2 + 156.7 s + 99.65
 
 
Transfer function:
          s^3 + 11 s^2 + 36 s + 26
--------------------------------------------
s^4 + 14.6 s^3 + 74.96 s^2 + 156.7 s + 99.65
 

ans =

    0.1374    0.0069    0.0003    0.0002

 
Transfer function:
 0.9961 s^2 + 1.196 s + 0.0398
--------------------------------
s^3 + 4.7 s^2 + 4.609 s + 0.1528
 
 
Transfer function:
  0.9961 s + 1.156
---------------------
s^2 + 4.661 s + 4.429
 
 
Transfer function:
  1.01
---------
s + 3.674
 

Attachments

  • 180918-160128.png
    180918-160128.png
    26.1 KB · Views: 141
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top