Professional Documents
Culture Documents
Exercise 6 - State-Space Models - Solutions - 2 PDF
Exercise 6 - State-Space Models - Solutions - 2 PDF
[ ] [ ][ ] [ ][ ]
[ ] [ ][ ] [ ][ ]
A general linear State-space model may be written on the following general form:
Faculty of Technology, Postboks 203, Kjlnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01
2
based on a damping ratio and natural frequency you specify. You >[A, B, C, D] = sys_order2(wn,
dr)
can use this function to create either a state-space model or a >ssmodel = ss(A, B, C, D)
transfer function model, depending on the output parameters
you specify.
Creates a step response plot of the system model. You also can >num=[1,1];
step >den=[1,-1,3];
use this function to return the step response of the model >H=tf(num,den);
outputs. If the model is in state-space form, you also can use this >t=[0:0.01:10];
>step(H,t);
function to return the step response of the model states. This
function assumes the initial model states are zero. If you do not
specify an output, this function creates a plot.
Creates the linear simulation plot of a system model. This >t = [0:0.1:10]
lsim >u = sin(0.1*pi*t)'
function calculates the output of a system model when a set of >lsim(SysIn, u, t)
inputs excite the model, using discrete simulation. If you do not
specify an output, this function creates a plot.
Example:
[ ] [ ][ ] [ ]
[ ][ ]
Solutions:
State-space model:
[ ] [ ][ ] [ ]
[ ][ ] []
Task 1.2
Given the following system:
Solution:
[ ] [ ][ ] [ ]
[ ] [ ][ ]
Task 1.3
Given the following system:
Solutions:
State-space model:
[ ] [ ][ ] [ ][ ]
[ ][ ] [ ][ ]
( )
Where
Task 2.1
Set the system on the following state-space form:
Assuming the control signal is equal to the force and that we only measure the position.
Solution:
We set:
This gives:
Finally:
[ ] [ ][ ] [ ]
[ ][ ]
i.e.:
[ ]
[ ]
[ ]
Task 2.2
Define the state-space model above using the ss function in MathScript.
Apply a step in u and use the step function in MathScript to simulate the result.
Solution:
MathScript Code:
clear
clc
ss_model = ss(A,B,C,D)
step(ss_model)
This gives:
Task 2.3
( )
Convert the state-space model defined in the previous task to a transfer function ( ) ( )
using
MathScript code.
Use , , .
Do the same using pen and paper and Laplace. Do you get the same answer?
Solution:
MathScript:
In MathScript we can simple use the tf function in order to convert the state-space model to a
transfer function.
H = tf(ss_model)
This gives:
( )
( )
( )
We set , , :
Laplace gives:
This gives:
or:
( )
Which gives:
and gives:
( )
( )
( )
Alternative metod:
[ ][ ] [ ]
[ ][ ]
( )
( ) ( )
( )
where:
[ ] [ ] [ ] [ ]
This gives:
( ) [ ] ([ ] [ ]) [ ]
Where:
[ ] [ ] [ ]
( ) [ ] [ ] [ ]
( )
( ) [ ][ ] [ ]
( ) [ ][ ]
This means:
( )
( ) ( )
( )
Task 3.1
Find the state-space model from the block diagram.
Note! and .
Solution:
This gives:
[ ] [ ][ ] [ ]
[ ][ ]
Task 3.2
Implement the state-space model in MathScript and simulate the system using the step function in
MathScript.
Set
And ,
Solution:
Task 4.1
Find the state-space model on the form (pen and paper):
Solution:
First we do:
This gives:
[ ] [ ][ ] [ ][ ]
[ ][ ] [ ][ ]
Task 4.2
Define the state-space model in MathScript and find the step response for the system. Discuss the
results.
Solution:
MathScript code:
clear,clc
A = [0 1; -1 -3];
B = [0 0; 2 4];
C = [5 6];
D = [7 0];
ssmodel = ss(A,B,C,D)
step(ssmodel)
Step response:
As you see we get 2 transfer functions because this is a so-called MISO system (Multiple Input, Single
Output).
Task 4.3
Find the following transfer functions:
( )
( )
( )
( )
( )
( )
Solution:
H = tf(ssmodel)
Transfer Function
Input:1 Output:1
7,000s^2+33,000s+17,000
-----------------------
1,000s^2+3,000s+1,000
Input:2 Output:1
24,000s+20,000
---------------------
1,000s^2+3,000s+1,000
As you see we get 2 transfer functions because this is a so-called MISO system (Multiple Input, Single
Output):
( )
( )
( )
( )
( )
( )
Additional Resources
http://home.hit.no/~hansha/?lab=mathscript