Hi I tried to find the state space form using Matlab but my
Hi, I tried to find the state space form using Matlab but my solution is different from Matlab matrix.
This is my code for part i) http://imgur.com/QCfOqXK and code for part ii) http://imgur.com/qfW4EeJ
Could you please take a look at the code and see what I did wrong? Also, try to work out the state space question. e.g x=Ax+Bu
Thank you!
Solution
One mistake found in first part is dimension of P . It should be 2X2 in part (1). The following codes are working, check.
--------------------------------------------------------------------------------------------------------------------------------------------
Dr = [1 3 12];
Nr = 4;
[A, B, C ,D] = tf2ss(Nr,Dr)
P=[0 1 ; 1 0 ];
Ap=inv(P)*A*P
Bp=inv(P)*B
Cp=C*P
Dp=D
-------------------------------------------------------------------------------------------------------------------------------------------
Output is shown below
Ap =
0 1
-12 -3
Bp =
0
1
Cp =
4 0
Dp =
0
----------------------------------------------------------------------------------------------------------------------------------------------
Dr = [1 14 540 20000];
Nr = [ 20 60 40];
[A, B, C ,D] = tf2ss(Nr,Dr)
P=[0 0 1 ; 0 1 0 ; 1 0 0 ];
Ap=inv(P)*A*P
Bp=inv(P)*B
Cp=C*P
Dp=D
-----------------------------------------------------------------------------------------------------------------------------------------------------
The output is shown below
Ap =
0 1 0
0 0 1
-20000 -540 -14
Bp =
0
0
1
Cp =
40 60 20
Dp =
0

