7.2. Transforms and Time Responses for State Space Models¶
Laplace Transform of State Space Models
Time Responses for State Space Models
Detailed example (in class)
Problems (homework)
7.2.1. Laplace Transforms of State Space Models¶
The Laplace transform can be used to convert a differential equation into a transfer function. It can also be used to convert a state space model into a transfer function. In this lecture we demonstrate how this is done and we give an example.
7.2.1.1. Laplace transform of a vector of functions¶
The Laplace transform of a vector \(\mathbf{v}(t)\) is a vector \(\mathbf{V}(s)\). The elements of \(\mathbf{V}(s)\) are the Laplace transforms of the corresponding elements of the vector \(\mathbf{v}(t)\).
For array
The transformed variables are
For example, if1
then $\(\mathbf{V}(s)=\left[ \begin{array}{c} 1/s \\ 1/(s+a) \\ b/(s^2+b^2) \\ \end{array} \right]\)$
7.2.1.2. Transform of State Equations¶
Let us now transform the generalized form of the state equations obtained in the last lecture.
Applying the Laplace transform to both sides of this matrix equation gives the transform equations
where \(\mathbf{x}(0)\) is the vector of initial conditions vector of the states; \(\mathbf{X}(s)\) is the state transform vector; \(\mathbf{U}(s)\) input transform vector; \(\mathbf{Y}(s)\) is output transform vector.
7.2.1.3. Transformed State-Equations for Example 1 from Section¶
For the system in the example the state vector is defined as \(\mathbf{x}=[v_{31}, i_1]^{T}\), the input current is \(u\), and the output variables are all the currents and voltages in the circuit \(\mathbf{y}=[v_{31}, i_1, v_{32}, v_{21}, i_2]^{T}\).
The transformed state space model is therefore:
7.2.2. Transfer function from State-Space Models¶
The transform equations may be solved as follows (the Laplace transform operator \(s\) is omitted for brevity).
Substituting \(\mathbf{X}\) from (1) into (2) gives
which after gathering terms and simplifying gives $\(\begin{equation} \mathbf{Y}=\left[\mathbf{C}\left[s\mathbf{I}-\mathbf{A}\right]^{-1}\mathbf{B}+\mathbf{D}\right]\mathbf{U} +\mathbf{C} \left[s\mathbf{I}-\mathbf{A}\right]^{-1}\mathbf{x}(0)\end{equation}\)$
When the initial conditions of the state-variables are all zero, this reduces to the transfer matrix model
The matrix \(\mathbf{C}\left[s\mathbf{I}-\mathbf{A}\right]^{-1}\mathbf{B}+\mathbf{D}\) is the system transfer matrix.
The element of the \(i\)-th row and \(j\)-th column is the transfer function that relates the \(i\)-th output transform \(Y_i\) to the \(j\)-th input transform \(U_j\).
For a single-input, single-output (SISO) system, the system transfer matrix reduces to a single element transfer function.
The matrix \(\left[s\mathbf{I}-\mathbf{A}\right]^{-1}\) is very important.
It is known as the resolvent matrix of the system.
It may be written as
7.2.2.1. Resolvent matrix for the example¶
For the system in the example, the resolvent matrix is developed as
When \(\left[s\mathbf{I}-\mathbf{A}\right]^{-1}\) has been obtained, then the system transfer function is easily obtained through \(\mathbf{C}\left[s\mathbf{I}-\mathbf{A}\right]^{-1}\mathbf{B}+\mathbf{D}\). For the system in the example, when all outputs are measured, the system transfer matrix is:
7.2.2.2. Transfer matrix for example¶
In matrix form, when combined with the input and output transforms we have the situation illustrated below. Each transfer function relates the corresponding output transform to the input transform.
For example
7.2.2.3. Transform Equations for Example¶
Note that the denominator is the same for each transfer function, and that the order of the numerator is less than the denominator except for one case, for which
Replacing \(s\) by \(\frac{d}{dt}\) gives the corresponding differential equations relating the dependant variable to the input.
7.2.2.4. Converting SS to TF in Matlab¶
We will do this in class
Continuing example from Section 7.1:
clear all
format compact
imatlab_export_fig('print-svg') % Static svg figures.
Define some values for capacitance, inductance and resitance
Cap = 1; L = 1; R = 1;
7.2.2.4.1. Define state space model and label states inputs and outputs¶
A = [0 -1/Cap; 1/L -R/L];
B = [1/Cap; 0];
C = [1 0; 0 1; 1 -R; 0 R; 0 -1];
D = [0; 0; 0; 0; 1];
circ_ss = ss(A, B, C, D, ...
'statename',{'v31' 'i1'}, ...
'inputname', 'u', ...
'outputname', {'v31' 'i1' 'v32' 'v21' 'i2'});
7.2.2.4.2. Show model¶
circ_ss
circ_ss =
A =
v31 i1
v31 0 -1
i1 1 -1
B =
u
v31 1
i1 0
C =
v31 i1
v31 1 0
i1 0 1
v32 1 -1
v21 0 1
i2 0 -1
D =
u
v31 0
i1 0
v32 0
v21 0
i2 1
Continuous-time state-space model.
7.2.2.4.3. Plot a step response¶
step(circ_ss)
7.2.2.4.4. Convert to transfer functiom matrix¶
The function tf(ss_model)
returns a vector of transfer functions.
circ_tf = tf(circ_ss)
circ_tf =
From input "u" to output...
s + 1
v31: -----------
s^2 + s + 1
1
i1: -----------
s^2 + s + 1
s - 3.14e-16
v32: ------------
s^2 + s + 1
1
v21: -----------
s^2 + s + 1
s^2 + s + 3.13e-16
i2: ------------------
s^2 + s + 1
Continuous-time transfer function.
7.2.2.4.5. Determine poles and zeros¶
circ_zpk=zpk(circ_ss)
circ_zpk =
From input "u" to output...
(s+1)
v31: -------------
(s^2 + s + 1)
1
i1: -------------
(s^2 + s + 1)
s
v32: -------------
(s^2 + s + 1)
1
v21: -------------
(s^2 + s + 1)
s (s+1)
i2: -------------
(s^2 + s + 1)
Continuous-time zero/pole/gain model.
7.2.2.4.6. The state transition matrix¶
Calculated using the symbolic math tools provided by MATLAB See help symbolic
syms phi t s
phi = inv(s*eye(2) - A)
phi =
[(s + 1)/(s^2 + s + 1), -1/(s^2 + s + 1)]
[ 1/(s^2 + s + 1), s/(s^2 + s + 1)]
7.2.2.4.7. The state transfer matrix¶
G = C*phi*B + D
G =
(s + 1)/(s^2 + s + 1)
1/(s^2 + s + 1)
(s + 1)/(s^2 + s + 1) - 1/(s^2 + s + 1)
1/(s^2 + s + 1)
1 - 1/(s^2 + s + 1)
G = simplify(G)
G =
(s + 1)/(s^2 + s + 1)
1/(s^2 + s + 1)
s/(s^2 + s + 1)
1/(s^2 + s + 1)
1 - 1/(s^2 + s + 1)
pretty(G)
/ s + 1 \
| ---------- |
| 2 |
| s + s + 1 |
| |
| 1 |
| ---------- |
| 2 |
| s + s + 1 |
| |
| s |
| ---------- |
| 2 |
| s + s + 1 |
| |
| 1 |
| ---------- |
| 2 |
| s + s + 1 |
| |
| 1 |
| 1 - ---------- |
| 2 |
\ s + s + 1 /
A executable script version of this example is available as ssmodels.mlx.
7.2.3. Some Important Properties¶
7.2.3.1. System poles¶
Clearly the denominator of the transfer function is generated by the matrix inverse which produces the term:
This evaluates to the denominator polynomial and the poles of the system are the roots of the system’s characteristic equation:
The system poles are solutions to the system’s characteristic equation
7.2.3.2. System zeros¶
What is the corresponding numerator polynomial of the transfer function, whose roots give the zeros of the system?
The zeros are those values of \(s\) for which the output is zero when the input and states are not zero.
Thus: $\(\begin{eqnarray*} (s\mathbf{I}-\mathbf{A})\mathbf{X}-\mathbf{B}U & = & \mathbf{0} \\ \mathbf{CX}+dU = Y & = & 0\end{eqnarray*}\)$
In matrix form:
The only way this can have non-zero solutions in \(\mathbf{X}\) and \(U\) is if:
This is another polynomial in \(s\) whose roots give the system zeros and therefore corresponds to the numerator polynomial of the TF.
Given this result, an alternative expression for the TF is:
7.2.4. Time Responses from Transfer Function Matrices¶
In the next section we will consider how we can use the transfer function model to compute time responses from state-space models.
7.2.5. Footnote¶
\(\epsilon(t)\) is the unit step function \(\epsilon(t)=0\) for \(t < 0\); \(\epsilon(t)=1\) for \(t \ge 0\).