Thread Subject: simulink

Subject: simulink

From: Bin Li

Date: 13 Nov, 2008 15:33:02

Message: 1 of 3

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);

Subject: simulink

From: checker

Date: 14 Nov, 2008 00:37:37

Message: 2 of 3

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

Subject: simulink

From: Khalid Khan

Date: 14 Nov, 2008 10:08:02

Message: 3 of 3

Li,
your system is written as:
\dot{x}_1=x_1+0.1 x_2 +0.005 u;
\dot{x}_2=x_2 + 0.1 u;

this can also be written as
\ddot{y}=2 \dot{y} - y + 0.005( \dot{u} -u)

so both systems are the same but written in different form. Matlab gices you results in canonical form.

Khalid

"Bin Li" <epxql@hotmail.com> wrote in message <gfhhbe$g78$1@fred.mathworks.com>...
> 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);
>

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
canonical form Khalid Khan 14 Nov, 2008 05:10:20
state eqution t... Bin Li 13 Nov, 2008 10:35:07
rssFeed for this Thread

Contact us at files@mathworks.com