Professional Documents
Culture Documents
OBJECTIVES:
Understand state-space representation of systems.
Representing physical systems in State Space using MATLAB.
Simulating the response of a system to standard inputs with State Space
Models
SUGGESTED READING:
Chapter 5: “State Space approach to Modeling Dynamic Systems”, from book “System
Dynamics”, by Ogata.
Lecture Notes on State Space by Dr. Salman, MCE Dept., UET Lahore
State Variable Description of LTI Systems
http://web.mit.edu/16.unified/www/FALL/signalssystems/Lecture11_12.pdf
Introduction to State Space Modeling
https://www.youtube.com/watch?v=X3TOZLJCWiY
SOFTWARE REQUIRED
MATLAB
where
u(t) is input signal, y(t) is output signal,
x(t) is n x 1 state vector,
A is n x n matrix, B is n x 1 matrix, C is 1 x n matrix, D is scalar
Fig.1: Block diagram of the linear continuous time system represented in state space
If the system is represented in the state space form (i.e broken down to matrices A,
B, C, D) a state-space model object can be created in MATLAB using the ‘ss’
command.
Example 1:
For a spring-mass-damper system represented by the following state equations,
create a state-space model in MATLAB and find its step response;
m= 10kg, k = 50N/m, b =20Ns/m
Solution:
Create the state matrix, and the output equation matrix.:
m=20;
k=50;
b=20;
A= [0 1;-k/m -b/m];
B= [0; 1/m];
C= [1 0];
Result:
Step Response
0.03
0.025
0.02
Amplitude
0.015
0.01
0.005
0
0 2 4 6 8 10 12
Time (seconds)
You can convert models from/to state-space model to/from other model (transfer
function model or zero-pole-gain model) using MATLAB commands.
The model type conversion paths and MATLAB commands are summarized in the
diagram below.
Example 3:
A system is represented by its transfer function as given below:
5 s+25
H (s)= 2
s +5 s+ 25
Result:
Example 4:
You can convert state-space model that obtained in Example 1 to transfer function
model by typing following commands in Command Window
m=20;
k=50;
b=20;
A= [0 1;-k/m -b/m];
B= [0; 1/m];
C= [1 0];
D=0;
[num,den] = ss2tf(A,B,C,D)
Result:
Example 5:
You can convert state-space model that obtained in Example 1 to zero-pole-gain
model by typing following commands in Command Window
m=20;
k=50;
b=20;
A= [0 1;-k/m -b/m];
B= [0; 1/m];
C= [1 0];
D=0;
[z,p,k] = ss2zp(A,B,C,D)
Result:
2) The plot of the poles and zeroes onto the s-plane can be obtained by using
MATLAB pzmap command from the object form. There is no specified
MATLAB command for obtaining the plot from the matrix form.
3) The unit impulse and step response can be determined by using the
MATLAB impulse and step commands respectively.
4) The zero-input response of LTI system with non-zero initial condition can be
determined by using the MATLAB initial command.
Example 6:
With the following system (H(s)) from example 3,
5 s+25
H (s)= 2
s +5 s+ 25
Determine, after representing the system in state space;
a) a pole-zero map
b) impulse response
c) step response
Solution:
You can convert transfer function model to state-space model by typing following
commands in Command Window
num = [5 25];
den = [1 5 25];
[A,B,C,D] = tf2ss(num,den);
sys1 = ss(A,B,C,D);
pzmap(sys1); % Plot appropriately on new
impulse(sys1); % figures by yourself
step(sys1);
Pole-Zero Map
Result: 5
4
System: sys1
Pole : -2.5 + 4.33i
3
System: sys1 Damping: 0.5
Imaginary Axis (seconds -1)
-1
System: sys1
-2
Pole : -2.5 - 4.33i
Damping: 0.5
-3
Overshoot (%): 16.3
Frequency (rad/s): 5
-4
-5
-5 -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0
Real Axis (seconds -1)
Impulse Response
5
3
Amplitude
-1
0 0.5 1 1.5 2 2.5
Time (seconds)
Step Response
1.4
1.2
1
Amplitude
0.8
0.6
MCT-304:
0.4
Modeling and Simulation 10
Department of Mechatronics
0.2 and Control Engineering, U.E.T Lahore
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (seconds)
University of Engineering and Technology, Lahore Fall 2016
1
G 2( s) = 2
s + s+1
Solution:
Code:
Output: