MCLECTURE15
MCLECTURE15
=
=
=
=
n
n
n
dt
y d
x
dt
y d
x
dt
dy
x
y x
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 10
Now differentiate both sides of this equation
to obtain the dynamic state equation:
n
n
n
dt
y d
dt
dx
dt
y d
dt
dx
dt
y d
dt
dx
dt
dy
dt
dx
=
=
=
=
.
.
.
3
3
3
2
2
2
1
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 11
The last equation may be solved for from the
original differential equation to give:
u b y a
dt
dy
a
dt
y d
a
dt
y d
a
dt
y d
n
n
n
n
n
n
n
n
0 0 1
2
2
2
1
1
1
... + =
+
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
=
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
0
3
2
1
1 1 0
1
3
2
1
.
.
.
0
0
0
.
.
.
*
1 . . . 0 0 0 0 0 0
.
.
.
0 . . . 0 1 0 0 0 0
0 . . . 0 0 1 0 0 0
0 . . . 0 0 0 1 0 0
0 . . . 0 0 0 0 1 0
.
.
.
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 14
Finally the solution to the differential
equation may be written as:
| |
(
(
(
(
(
(
(
(
(
(
(
(
(
(
=
n
x
x
x
x
y
.
.
.
* 0 0 . . . 0 10
3
2
1
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 15
In matrix form
State equation
Output equation
dx
dt
Ax Bu = +
y Cx Du = +
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 16
Example
) (
2
2
2
t T
MgL
dt
d
D
dt
d
J = + + u
u u
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 17
Using the phase variables as state
variables
x
x
d
dt
1
2
=
=
u
u
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 18
Then the dynamic state equations may be
developed using the definition and the
system equation
dx
dt
x
dx
dt
MgL
J
x
D
J
x
T t
J
1
2
2
1 2
=
=
+ sin( )
( )
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 19
This is the state variable form for the
dynamic system. The output y is simply x
1
These may be written in
the linear state
equations matrix form
dx
dt
x
dx
dt
D
J
x
MgL
J
x
T t
J
y x
1
2
2
2 1
1
=
= +
=
( )
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 20
Matrix definitions
] 0 [ ] 0 1 [
1
0 1 0
= =
(
(
=
(
(
=
D C
J
B
J
D
J
MgL
A
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 21
Matlab has built in conversions
ss2tf state space to transfer function
tf2ss transfer function to state space
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 22
Example try this
Num=[24];
Den=[1,9,26,24];
[A,B,C,D]=tf2ss(num,den)
A =
-9 -26 -24
1 0 0
0 1 0
B =
1
0
0
C =
0 0 24
D =
0
c y
dt c d x
dt dc x
c x
iables State
s s s s R
s C
=
=
=
=
+ + +
=
2 2
2 3
/
/
var
24 26 9
24
) (
) (
3
2
1
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 23
Now try ss2tf
[num,den]=ss2tf(A,B,C,D)
num =
0 0.0000 0.0000 24.0000
den =
1.0000 9.0000 26.0000 24.0000
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 24
Practice exercises
Given a differential
equation
Write the transfer
function
) ( ) ( 24 26 9
2
2
3
3
t r t c
dt
dc
dt
c d
dt
c d
= + + +
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 25
Answer
24 26 9
1
) (
) (
2 3
+ + +
=
s s s s R
s C
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 26
Given a transfer function write the
differential equation
6 2 9
2
) (
) (
2 3
+ + +
=
s s s s R
s C
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 27
Answer
) ( 2 ) ( 6 2 9
2
2
3
3
t r t c
dt
dc
dt
c d
dt
c d
= + + +
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 28
Given a transfer function compute the
step response with Matlab
24 26 9
24
) (
) (
2 3
+ + +
=
s s s
s R
s C
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 29
Answer
Num=[24];
Den=[1,9,26,24];
Sys=tf(num,den);
Step(Sys)
Time (sec.)
A
m
p
l
i
t
u
d
e
Step Response
0 0.5 1 1.5 2 2.5 3
0
0.2
0.4
0.6
0.8
1
1.2
1.4
From: U(1)
T
o
:
Y
(
1
)
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 30
Cascade two transfer function into a single
equivalent block diagram
H1=1/(s+1) H2=s+1
G(s)
F(s)
G1(s)
=?
F(s)
G(s)
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 31
Answer
1
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 32
Compute the transfer function of a
closed loop system
=(s+2)/(s+3)
1
R(s)
C(s)
-
+
E(s)
F(s)
G
c
(s)=K
E(s)
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 33
Answer
) 2 ( 3
) 2 (
) (
) (
+ + +
+
=
s K s
s K
s R
s C
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 34
Determine if a system is relatively stable
using the Matlab margin function.
G(s) = (s+2)/(s+3)
H(s) = 1
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 35
Answer
Num=[1,2];
Den=[1,3];
Margin(Num,Den)
As shown the phase
margin is greater than
40 degrees and the
gain margin is greater
than 10 dB so the
system is relatively
stable.
Frequency (rad/sec)
P
h
a
s
e
(
d
e
g
)
;
M
a
g
n
i
t
u
d
e
(
d
B
)
Bode Diagrams
-4
-3
-2
-1
0
Gm = Inf, Pm=-179.64 deg. (at 158.09 rad/sec)
10
-1
10
0
10
1
10
2
10
3
0
50
100
150
200
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 36
Determine if a system is absolutely
stable by examining the pole zero map
24 26 9
24
) (
) (
2 3
+ +
=
s s s s R
s C
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 37
Answer
Num=[24];
Den=[1,9,-26,24];
Pzmap(num,den)
As shown the system is
absolutely stable since
the poles are all in the
left half plane.
-4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0
-1.5
-1
-0.5
0
0.5
1
1.5
x 10
8
Real Axis
I
m
a
g
A
x
i
s
Pole zero map
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 38
Determine the absolute stability of the
following system using pole zero map
24 26
24
) (
) (
2
+
=
s s
s R
s C
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 39
Answer
Num=[24];
Den=[1,-26,24];
Pzmap(Num,Den)
As shown it is
absolutely unstable
since it has two poles in
the rhp.
0 5 10 15 20 25 30
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Real Axis
I
m
a
g
A
x
i
s
Pole zero map
11/2/2013 (C) 2001, Ernest L. Hall, University of Cincinnati 40
Any questions?