0% found this document useful (0 votes)
22 views8 pages

Alina Shah Dcs Lab 6

Uploaded by

tali66261
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views8 pages

Alina Shah Dcs Lab 6

Uploaded by

tali66261
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Lab 6

State Space
Representation

Alina Shah (F20603051)


State space representation
Two first-order equations governing the state variables were obtained from the second-order
input-output differential equation and the definitions of the state variables. These equations
are known as state equations. In general, there are n state equations for an nth-order system.
State equations can be obtained for state variables of systems described by input-output dif-
ferential equations, with the form of the equations depending on the nature of the system. For
example, the equations are time varying for time-varying systems and nonlinear for nonlinear
systems. State equations for linear time invariant systems can also be obtained from their
transfer functions. The algebraic equation expressing the output in terms of the state variables
is called the
output equation. For multi output systems, a separate output equation is needed to define each
output. The state and output equations together provide a complete representation for the sys-
tem described by the differential equation, which is known as the state space representation.
For linear systems, it is often more convenient to write the state equations as a single matrix
equation referred to as the state equation. Similarly, the output equations can be combined in
a single-output equation in matrix form. The matrix form of the state space representation is
demonstrated.

Analog version is as below:


Ẋ =AX ( t )+ BU ( t )

Y ( t )=CX ( t ) + DU (t)

State variables as described above


Ẋ 1= X 2

State representation in matrix form

[ ] [ ][ ] [ ]
0
x˙1 = 0 1 x 1 +
1 u
x˙2 0 0 x2
m
y=¿

Solution

Using Laplace
sX ( s ) − X ( 0 )= AX ( s ) +BU (s)

[ sI − A ] X ( s ) =X ( 0 ) + BU (s )
−1 −1
X ( s ) =[ sI − A ] X ( 0 ) + [ sI − A ] BU (s)
A=n * n state matrix
B=n *m input or control matrix
C=l *n output matrix
D=l *m direct transmission matrix

State space representation in MATLAB

MATLAB has a special state space representation obtained with the command ss.However,
some state commands only operate on one or more of the matrices (A, B, C, D).

To enter a matrix

A=
[ −51 14 ]
Use the command

A=[1 ,1 ; −5 , − 4]

If B, C, and D are similarly entered, we obtain the state space quadruple p with
the command

p=ss( A , B , C , D)

We can also specify names for the input (torque, say) and output (position) using
the set command

set ( ' p' ,' input ' ,‘ output ’ , ‘ torque ’ ,‘ position ’ )


Task 1:

The state equations of an armature-controlled DC motor are given by

[ ] [ ][ ] [ ]
ẋ 1 ( t ) 01 0 x1 0
ẋ 2 ( t ) = 0 01 x2 + 0 U (t)
ẋ3 ( t ) 0− 10 −11 x 3 10

Find the following:

1. The state-transition matrix


2. The response due to a unit step input
MATLAB commands
MATLAB obtains the transfer function for the matrices (A, B, C, D) with the commands

g=tf (ss ( A . B ,C , D ))
To create a transfer function matrix, we define its numerator and denominator then use the
command tf as in the case of a scalar transfer function. The numerator is created as a cell ar-
ray with each entry including a vector of coefficient from the corresponding numerator poly-
nomial. The denominator is created similarly using denominator polynomials. For example,
to create the transfer function we obtained in our example.

H=tf ( num, den )

Discrete-time State Space Representation


Given an analog system with piecewise constant inputs over a given sampling period, the
System state variables at the end of each period can be related by a difference equation.
The difference equation is obtained by examining the solution of the analog state equation as
in previous section.
tf

X ( t f )=e A ( t −t ) X ( t 0 )+∫ e A (t − τ ) BU ( τ ) dτ
f 0 f

t0

Now assuming the initial and final time correspond to t 0=kT and t f =( k +1 ) T
( k +1) T
AT
X ( k +1 )=e X ( k )+ ∫ e A ( (k +1) T − τ ) BU ( τ ) dτ
kT

u ( t )=u ( k ) wℎen kT ≤t < ( k + 1 ) T


Let θ=( k +1 ) T − τ
dθ=− dτ
τ =kT →θ=T
τ =( k +1 ) T → θ=0

MATLAB commands for discrete-time state space equations


The MATLAB command to obtain the discrete state space quadruple Pd from the
Continuous quadruple p with sampling period T = 0.1 is

pd=c 2 d ( p ,.1)
Ad=expm( A ∗ 0.1)

Bd=A ( Ad −eye ( ¿( A ¿) ) ) ∗ B
Example:
The RLC resonance circuit of figure below with capacitor voltage as output has the state
space model

[ ]
0 1
ẋ=

1
LC L
[]
R x+ 0 u
1

Assuming normalized component values such that R/L=2, 1/LC=10 Obtain the discrete stat
and input matrix for the series resonances circuit with a DAC and ADC and a sampling
period T. Evaluate the matrices for T = 0.05 s and check your answer with MATLAB.

Solution :
Task 2:

Find the equivalent discrete-time state-space representation (Let T=0.01s)

[ ] [ ][ ] [ ]
ẋ 1 ( t ) 01 0 x1 0
ẋ 2 ( t ) = 0 01 x2 + 0 U (t)
ẋ3 ( t ) 0− 10 −11 x 3 10

Z-transfer function in MATLAB

The expressions for obtaining z-domain and s-domain transfer functions differ only in that
Z in the former is replaced by s in the latter. The same MATLAB command is used to obtain
s-domain and z-domain transfer functions. The transfer function for the matrices (Ad, Bd, C,
D) is obtained with the commands.
P = ss(Ad, Bd, C, D,T)
Where T is the sampling period. The poles and zeros of a transfer function are obtained with
the command.
gd = tf(p)
zpk(gd)

Comments:
In conclusion the first MATLAB code smoothly transforms a continuous-time system into its discrete-
time counterpart using the c2d function, where we specify the sampling period. It's like converting a
movie from regular speed to slow motion. The code then extracts the necessary matrices for the dis-
crete-time system from the result. Adding comments would help understand each part better.
The second MATLAB code, using the ss command, translates the discrete-time system matrices into
a transfer function, showing how the system behaves in a different representation. Think of it as
converting a recipe into a finished dish. By examining the poles and zeros with the zpk function, we
can understand key characteristics like stability and frequency response. Adding comments and in-
terpretations of the poles and zeros would provide deeper insight into the system's behaviour.

You might also like