You are on page 1of 27

This example is from the previous slides.

Here we can find the


state space representation

z1(s)+z2(s)

R=1;
L=.25;
C=4;
n=1;
d=[L*C R*C 1];
s=tf(n,d)
1
------------s^2 + 4 s + 1

n=sqrt(1/(L*C))= 50

=(R/2)*sqrt(C/L)

t=0:20;
y=1+.0774*exp(-3.732*t)1.0774*exp(-.2679*t);

Vi Rx1 Lx 1 x 2
Cx 2 x1
R
1
1
x1 x 2 Vi
L
L
L
1
x 2 x1
C
x 1

A=[-R/L -1/L;1/C 0];


eig(A)
ans =

-3.7321
-0.2679

Eigenvalues of A matrix and poles


of transfer function are same

State Equations

x1 4 x1 4 x2 4u
x 2 .25 x1
y x2
u=1

dif.m
function c= dif(t,x);
A=[-4 -4; 0.25 0];
B=[4;0];
c=A*x+B;

This in an m file named dif

x0=([0;.0]);
ts=[0 20];
[t,x]=ode23('dif',ts,x0);
Copy this in command
window

1
0.9

Plot(t,x)

0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0

10

12

14

16

18

20

plot(x(:,1),x(:,2))

1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Simple Pendulum

Simple Pendulum
Assume m=g=1

sin 0
x1 x2 ;
x 2 sin x1

function c= pend(t,x);
c=[x(2);-sin(x(1))];

ts=[0 20];
x0=[.5;-.5];
[t,x]=ode23('pend', ts,x0);
plot(t,x)
plot(x(:,1),x(:,2))

Solving state equations


X(s) (sI A) 1 x(0) (sI A) 1 BU(s)
1

Y(s) C(sI A) x(0) [C(sI A) B D] U(s)

Converting a Transfer Function to State Space


A set of state variables is called phase variables, where each
subsequent state variable is defined to be the derivative of the
previous state variable.
Consider the differential equation
dny
d n1 y
dy

a
a0 y b0u
n 1
1
dt n
dt n1
dt

Choosing the state variables


x1 y
dy
dt
d2y
x3 2
dt

d n1 y
xn n1
dt

dy
x2
dt
d2y
x 2 2 x3
dt
d3y
x 3 3 x4
dt

x1

x2

dny
x n n a0 x1 a1 x2 an1 xn b0u
dt

x 1
x
2
x 3

x n1

x
n

0
0

a0

1
0
0

0
1
0

0
0
1

0
0
0

0
a1

0
a2

0
a3

0
a4

x1
x
2
x3
y 1 0 0 0 0

xn1

xn

x1 0
x 0
2
x3 0

u

1 xn1 0


an1 xn b0

0
0
0

Converting a transfer function with constant term in


numerator

Step 1. Find the associated differential equation.


C ( s)
24
3
R ( s ) s 9 s 2 26 s 24
( s 3 9 s 2 26 s 24)C ( s ) 24 R ( s )
c 9c 26c 24c 24r

Step 2. Select the state variables.


Choosing the state variables as successive derivatives.
x1 c
x2 c
x3 c

x1 x2
x 2 x3
x 3 24 x1 26 x2 9 x3 24r
y x1

Converting a transfer function with polynomial in numerator


Step1. Decomposing a transfer function.

X 1 ( s)
1

R ( s) a3 s 3 a2 s 2 a1s a0

Y ( s ) C ( s ) (b2 s 2 b1s b0 ) X 1 ( s )

Step 2. Converting the transfer function with constant term in numerator.


X 1 ( s)
1

R( s ) a3 s 3 a2 s 2 a1s a0

Step 3. Inverse Laplace transform.


Y ( s ) C ( s ) (b2 s b1s b0 ) X 1 ( s )
2

y (t ) b0 x1 b1 x 2 b2 x 3

d 2 x1
dx
y (t ) b2 2 b1 1 b0 x1
dt
dt

Converting from state space to a transfer function


Given the state and output equations
x Ax Bu
y Cx Du

Take the Laplace transform assuming zero initial conditions:


sX( s ) AX( s ) BU( s )
Y( s) CX( s ) DU( s )

(1)
(2)

Solving for X(s) in Eq. (1),


( sI A) X( s) BU ( s)

or
X( s ) ( sI A ) 1 BU( s)

Substitutin Eq. (3) into Eq. (2) yields


Y( s) C( sI A) 1 BU( s ) DU( s )
[C( sI A) 1 B D]U( s )

The transfer function is

Y( s )
C( sI A ) 1 B D
U( s )

(3)

Ex. Find the transfer from the state-space representation


1
0
0
10
x 0
0
1 x 0 u
1 2 3
0

y 1 0 0 x

Solution:
1
0 s 1
0
s 0 0 0
( sI A) 0 s 0 0
0
1 0 s
1
0 0 s 1 2 3 1 2 s 3
s 2 3s 2
s3
1

1
s

3
s
s

2
s
2s 1 s
adj ( sI A)
1
( sI A)

det( sI A)
s 3 3s 2 2 s 1
Y ( s ) 10( s 2 3s 2)
3
U ( s ) s 3s 2 2 s 1

Types of Eqbm. points


Node
x 3x 2 x 0.

1
0

2 3

eig(A)
-1
-2

Types of Eqbm. points


Node
x 3x 2 x 0.

1
0

2 3

eig(A)
-1
-2

x x x 0.

eig(A)

0 1
A

-0.5000 + 0.8660i
-0.5000 - 0.8660i
3

-1

-2

-3

-4

20

40

60

80

100

120

eig(A)
0 + 1.0000i
0 - 1.0000i

5
4
3
2
1
0
-1
-2
-3
-4
-5

20

40

60

80

100

120

4. Saddle Po int
x x 2 x 0.
Separatrices

0 1
A

2 1

x x x 0.

eig(A)

0 1
A

-0.5000 + 0.8660i
-0.5000 - 0.8660i

-1

-2

-3

-4

20

40

60

80

100

120

eig(A)
0 + 1.0000i
0 - 1.0000i

5
4
3
2
1
0
-1
-2
-3
-4
-5

20

40

60

80

100

120

Types of equilibrium points of second order linear systems

Prey predator model

x 1 ax1 bx1 x 2
a 1, b 0.03, c 0.02, d 1
x 2 dx 2 cx1 x 2
lions and gazelles,
birds and insects,
pandas and eucalyptus trees,
herbivore-plant,
parasitoid-host,
Venus fly traps and flies.

x1 is the prey population


X2 predator population

Assumptions
the predator species is totally dependent on a single prey
species as its only food supply,
the prey species has an unlimited food supply, and
there is no threat to the prey other than the specific
predator.
.
A good model must be simple enough to be
mathematically tractable, but complex enough to
represent a system realistically.

In the model the parameter a is the growth rate of species


(the prey) in the absence of interaction with species (the
predators). If there were no predators, the prey species grows
exponentially. But there are predators, which must account for
a negative component in the prey growth rate. The rate at
which predators encounter prey is jointly proportional to the
sizes of the two populations. A fixed proportion of encounters
lead to the death of the prey. Thus the negative component of
the prey growth rate is proportional to the product of the
population sizes, i.e.,
The parameter d is the death (or emigration) rate of species
in the absence of interaction with species. If there were no
food supply, the population would die out at a rate
proportional to its size, i.e. we would find
the term c denotes the net rate growth of the predator
population in response to the size of the prey population.

You might also like