|
On Nov 13, 8:33 am, "Bin Li" <ep...@hotmail.com> wrote:
> I have a state equation: A=[1 0.1;0 1]; B=[0.005;0.1]; C=[1 0]; D=[0]; and want to convert it into a transfer function when using Matlab function: (sys1=ss(A,B,C,D);trf1=tf(sys1). The result is:
> 0.005 s + 0.005
> ---------------
> s^2 - 2 s + 1
>
> then I want to verify it by using tf2ss to convert back:
> x2=[0.005 0.005];%transfer function numerator
> x1=[1 -2 1];%transfer function denominator
> [A1,B1,C1,D1]=tf2ss(x2,x1);
>
> The state equation becomes: A1=[2 -1;1 0]; B1=[1;0]; C1=[0.005 0.005]; D1=[0];rather than A=[1 0.1;0 1]; B=[0.005;0.1]; C=[1 0]; D=[0];
> I don't understand what is wrong. Could somebody help me, please? Thanks a million!
>
> The code is below:
> Clear;
> Clc;
> A=[1 0.1;0 1];
> B=[0.005;0.1];
> C=[1 0];
> D=[0];
> sys1=ss(A,B,C,D);%
> trf1=tf(sys1);%get the transfer function of the state equation
> %===Transfer function to state space
> x2=[0.005 0.005];%transfer function numerator
> x1=[1 -2 1];%transfer function denominator
> [A1,B1,C1,D1]=tf2ss(x2,x1);%transfer function to state space: X=A1x+B1u; Y=C1x+D1u
> sys2=ss(A1,B1,C1,D1);
> trf2=tf(sys2);
Bin Li:
Try for instance bode(sys1) and bode(sys2) and think about what you
see.
(BTW, this isn't a simulink question).
-Chris
|