MATLAB: Controllable and observable canonical form

controllableobservable

Hi, I want to convert a transfer function to controllable and observable canonical form. Tried with tf2ss but it did not work. I am sharing a part of my code. Is there any way to get those A,B,C,D matrices by any Matlab functions??
My code:
clc; clear all;
Den=[0 1 1]; Num=[1 5 6];
s=tf(Den,Num)
[A B C D]=tf2ss(s)

Best Answer

The tf2ss function wants a transfer function as input, not a system object.
Try this:
[A B C D]=tf2ss(Den,Num)
A =
-5 -6
1 0
B =
1
0
C =
1 1
D =
0
EDIT
To get the state space representation from a system object, just use the ss funciton:
[A B C D] = ss(s);