Continue to Site

# ss2tf and tf2ss is not consistent

Status
Not open for further replies.

#### david753

##### Full Member level 1
Dear sir, I use ss2tf function in matlab. Its output values input to tf2ss function. But the result is not equal to the original input. (A1,B1,C1,D1) IS NOT EQUAL TO (A,B,C,D.)

What wrong is it?

clear;

A=[0 1 0;0 0 1;-9 -8 -7];

B=[7;8;9];

C=[2 3 4];

D=[0];

[num, den]=ss2tf(A,B,C,D,1);

[a1,b1,c1,d1]=tf2ss(num,den);

a1 =

-7.0000 -8.0000 -9.0000
1.0000 0 0
0 1.0000 0

b1 =

1
0
0

c1 =

74.0000 -199.0000 -235.0000

d1 =

0

There is nothing wrong. Matlab tf2ss algorithm use a canonical realization to compute num.den (see State space (controls) - Wikipedia, the free encyclopedia)

For a given transfer function den.num, there exist infinity possible state space representations. So, ABCD and a1b1c1d1 have the same transfer function. The use of this, is that you can have a lot of different structures that you can implement an will give you the same response. To select between different structures, you should take in account round-off error effects vs speed (i.e. some structures will require more multiplications, but will have better signal to noise ratio - some structures will be more stable than others or less prone to overflow, etc)

If by "no consistent" you mean that tf2ss( ss2tf(x) ) != x, you are right.

drz

Status
Not open for further replies.