Controllable and observable canonical form

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)

 Respuesta aceptada

Star Strider
Star Strider el 21 de Feb. de 2017
Editada: Star Strider el 21 de Feb. de 2017
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);

5 comentarios

M. M.  Farhad
M. M. Farhad el 21 de Feb. de 2017
But does tf2ss convert to controllable canonical form or observable canonical form?? I did the same but it does not match those forms.
It does, but not directly. It produces the ‘[A B C D]’ matrices.
You must use the canon function with the 'companion' option to get the controllability canonical form, that it produces by default.
The observability canonical form requires that you transpose the ‘A’ matrix it produces, and then the ‘B’ vector (or matrix) becomes the transposed ‘C’, and the ‘C’ vector (or matrix) becomes the transposed ‘B’.
Example with your system:
Den = [0 1 1];
Num = [1 5 6];
s = tf(Den,Num);
s_ss = ss(s);
s_can_c = canon(s_ss, 'companion');
Controllability
Amtx_c = s_can_c.A
Bmtx_c = s_can_c.B
Cmtx_c = s_can_c.C
Amtx_c =
0 -6
1 -5
Bmtx_c =
1
0
Cmtx_c =
1 -4
Observability
Amtx_o = s_can_c.A'
Bmtx_o = s_can_c.C'
Cmtx_o = s_can_c.B'
Amtx_o =
0 1
-6 -5
Bmtx_o =
1
-4
Cmtx_o =
1 0
I went back to my textbooks to be certain I got this correct. It would help if MATLAB made these a bit easier to find and interpret in the documentation, but then understanding the Jordan-form and companion matrices are essential to understanding controllability and observability.
I apologise for the delay. Life intrudes.
Christopher Rösel
Christopher Rösel el 14 de Dic. de 2017
Isn´t it supposed to be the other way around? Your controllable canonical form is your observable canonical form? I checked your code with another transfer function and it doesn´t provide me the results I calculated.
Mohamed Ibrahim
Mohamed Ibrahim el 1 de En. de 2018
It is, yes.
Shady Hassan
Shady Hassan el 31 de Mzo. de 2018
its the other way around, controllability and observability matrices are reversed in zour explanation above..

Iniciar sesión para comentar.

Más respuestas (1)

Mackyle Naidoo
Mackyle Naidoo el 11 de Jun. de 2022

0 votos

i would like to obtain the state space repsentation for controllable , observable and diagonal canonical form
using the following transfer function of the 𝑌𝑌(𝑠𝑠) 𝑈𝑈(𝑠𝑠) = 𝑠 + 4 /𝑠^2 + 13s + 42. Using matlab code to get the desired outcome can anyone help?

5 comentarios

Sam Chak
Sam Chak el 11 de Jun. de 2022
Editada: Sam Chak el 11 de Jun. de 2022
Your transfer function looks strange when interpreted according to standard order of operations in inline math mode and computer programming.
If you this is not, please enter it in MATLAB code. I'll show an example:
If , then type:
G = tf([2],[3 5])
G = 2 ------- 3 s + 5 Continuous-time transfer function.
Star Strider
Star Strider el 11 de Jun. de 2022
This should be posted as a new Question.
Mackyle Naidoo
Mackyle Naidoo el 12 de Jun. de 2022
@Sam Chak transfer function in matlab is as follows
g = tf ([1,4],[1^2 13 42])
@star strider how do i post this as a new question ?
Star Strider
Star Strider el 12 de Jun. de 2022
Start here.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink en Centro de ayuda y File Exchange.

Preguntada:

el 21 de Feb. de 2017

Comentada:

el 12 de Jun. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by