Practical 9
Practical 9
Practical 9
ECE325
Why State Space Models
y=x
Cont…
statespace = ss(A, B, C, D)
b=
u1
x1 0
x2
0.5
c=
x1 x2
y1 1 0
Cont…
d =
u1
y1 0
Contin
uous-
time
model.
EXTRACTING A, B, C, D
MATRICES FROM A STATE
SPACE MODEL
In order to extract the A, B, C, and D
matrices from a previously defined state
space model, use MATLAB's ssdata
command.
[A, B, C, D] = ssdata(statespace)
16
State-Space Modeling with MATLAB
MATLAB uses the controllable canonical form by default when converting from
a state space model to a transfer function. Referring to the first example
problem, we use MATLAB to create a transfer function model and then convert
it to find the state space model matrices:
17
Implement the formula on
MATLAB
State-Space Modeling with MATLAB
Note that this does not match the result we obtained in the first example. See
below for further explanation. No we create an LTI state space model of the
system using the matrices found above:
19
State-Space Modeling with MATLAB
we can generate the observable and controllable models as follows:
20
Example
>> [A, B, C, D] = ssdata(statespace_ss)
The MATLAB output will be:
A =
-2.5000 -0.3750
4.0000 0
Cont…
B=
0.2500
0
C=
0.5
000
D=
STEP RESPONSE USING THE
STATE SPACE MODEL
Once the state space model is entered into MATLAB it is easy
to calculate the response to a step input. To calculate the
response to a unit step input, use:
step(statespace)
where statespace is the name of the state space system.
For steps with magnitude other than one, calculate the step
response using:
step(u * statespace)
where u is the magnitude of the step and statespace is the
name of the state space system.
Controllability, Observability and Stability of
Discrete Time Systems
• Controllability deals with the possibility of forcing the system to
a particular state by appli-cation of a control input. If a state is
uncontrollable then no input will be able to control that state.
• On the other hand whether or not the initial states can be
observed from the output is determined using observability
property.
• Thus if a state is not observable then the controller will not be
able to determine its behavior from the system output and
hence not be able to use that state to stabilize the system.
• https://www.youtube.com/watch?v=BYvTEfNAi38
• https://www.quora.com/What-are-the-differences-between-controll
ability-and-observability
• Note that this is a basic explanation of these concepts. Most importantly a state variable (x or y in the
answer) does not need to be directly actuated to be controllable, whereas it also does not need to be
directly measured to be observable. The heart of the issue is that, for a state variable to be controllable the
actuators must be able to influence it, whereas for it to be observable, it must be inferable from the
sensors. More generally, for a system to be controllable, the actuators must be able to influence its state
(i.e., all state variables), whereas for it to be observable, its state must be inferable from the sensors.
• Controllability and observability of state space
model
1. g = ctrb(sys) /g gives a controllability matrix of
state space model sys/
You can find rank of g by using command rank(g)
and comment on the controllability of system
2. g1 = obsv(sys) /g1 gives observability matrix of
state space model sys/
Assignment
Implement all the commands on
this system