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

\[\begin{split}\mathbf{v}(t) = \left[ \begin{array}{c} v_1(t) \\ v_2(t) \\ \vdots \\ v_n(t) \\ \end{array} \right]\end{split}\]

The transformed variables are

\[\begin{split}\mathcal{L}\mathbf{v}(t) = \left[ \begin{array}{c} \mathcal{L} v_1(t) \\ \mathcal{L} v_2(t) \\ \vdots \\ \mathcal{L} v_n(t) \\ \end{array} \right] = \left[ \begin{array}{c} V_1(s) \\ V_2(s) \\ \vdots \\ V_n(s) \\ \end{array} \right] = \mathbf{V}(s)\end{split}\]

For example, if1

\[\begin{split}\mathbf{v}(t)=\left[ \begin{array}{c} \epsilon(t) \\ e^{-at} \\ \sin bt \\ \end{array} \right]\end{split}\]

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.

\[\begin{split}\begin{eqnarray*} \frac{d\mathbf{x}(t)}{dt} &=& \mathbf{A}\mathbf{x}(t)+\mathbf{B}\mathbf{u}(t)\\ \mathbf{y}(t)&=&\mathbf{C}\mathbf{x}(t)+\mathbf{D}\mathbf{u}(t)\end{eqnarray*}\end{split}\]

Applying the Laplace transform to both sides of this matrix equation gives the transform equations

\[\begin{split}\begin{eqnarray*} s\mathbf{X}(s)-\mathbf{x}(0) &=& \mathbf{A}\mathbf{X}(s)+\mathbf{B}\mathbf{U}(s)\\ \mathbf{Y}(s)&=&\mathbf{C}\mathbf{X}(s)+\mathbf{D}\mathbf{U}(s)\end{eqnarray*}\end{split}\]

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:

\[\begin{split}\begin{eqnarray} s\left[\begin{array}{c} V_{31} \\ I_1 \end{array}\right]-\left[\begin{array}{c} v_{31}(0) \\ i_1(0) \end{array}\right]&=&\left[\begin{array}{cc} 0 & -1/C \\ 1/L & -R/L \end{array}\right]\left[\begin{array}{c} V_{31} \\ I_1 \end{array}\right]+\left[\begin{array}{c} 1/C \\ 0 \end{array}\right]\left[U\right]\\ \left[\begin{array}{c} V_{31} \\ I_1 \\ V_{32} \\ V_{21} \\ I_{2} \end{array}\right]&=&\left[\begin{array}{cc} 1 & 0 \\ 0 & 1 \\ 1 & -R \\ 0 & R \\ 0 & -1 \end{array}\right]\left[\begin{array}{c} V_{31} \\ I_1 \end{array}\right]+\left[\begin{array}{c} 0 \\ 0 \\ 0 \\ 0 \\ 1 \end{array}\right]\left[U\right].\end{eqnarray}\end{split}\]

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

\[\begin{equation} \mathbf{Y}=\left[\mathbf{C}\left[s\mathbf{I}-\mathbf{A}\right]^{-1}\mathbf{B}\mathbf{U}+ \mathbf{C}\left[s\mathbf{I}-\mathbf{A}\right]^{-1}\mathbf{x}(0)\right]+\mathbf{D}\mathbf{U}\end{equation}\]

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

\[\begin{equation} \mathbf{Y}=\left[\mathbf{C}\left[s\mathbf{I}-\mathbf{A}\right]^{-1}\mathbf{B}+\mathbf{D}\right]\mathbf{U}\end{equation}\]

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

\[\left[s\mathbf{I}-\mathbf{A}\right]^{-1} = \frac{\mathrm{adj}\left[s\mathbf{I}-\mathbf{A}\right]} {\det\left[s\mathbf{I}-\mathbf{A}\right]}.\]

7.2.2.1. Resolvent matrix for the example

For the system in the example, the resolvent matrix is developed as

\[\begin{split}\begin{equation*} \mathbf{A}=\left[\begin{array}{cc} 0 & -1/C \\ 1/L & -R/L \end{array}\right] \end{equation*}\end{split}\]
\[\begin{split}\begin{equation*} s\mathbf{I}-\mathbf{A}=\left[ \begin{array}{cc} s & 0 \\ 0 & s \end{array} \right] - \left[ \begin{array}{cc} 0 & -1/C \\ 1/L & -R/L \end{array} \right] = \left[ \begin{array}{cc} s & +1/C \\ -1/L & s+R/L \end{array}\right] \end{equation*}\end{split}\]
\[\begin{split}\begin{equation*} \left[s\mathbf{I}-\mathbf{A}\right]^{-1}=\frac{ \left[\begin{array}{cc} s+R/L & -1/C \\ +1/L & s \end{array} \right] }{s(s+R/L)+1/(LC)}=\frac{\left[\begin{array}{cc} s+R/L & -1/C \\ +1/L & s \end{array} \right]}{s^2 + (R/L)s + 1/(LC) }\end{equation*}\end{split}\]

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

\[\begin{split}\begin{equation*} \left[\begin{array}{cc} 1 & 0 \\ 0 & 1 \\ 1 & -R \\ 0 & R \\ 0 & -1 \end{array}\right] \left\{\frac{\left[ \begin{array}{cc} s+R/L & -1/C \\ +1/L & s \end{array}\right]}{s^2 + (R/L)s +1/(LC)}\right\} \left[\begin{array}{c} 1/C \\ 0 \end{array}\right] + \left[\begin{array}{c} 0 \\ 0 \\ 0 \\ 0 \\ 1 \end{array} \right] \end{equation*}\end{split}\]
\[\begin{split}\begin{equation*} = \left[\begin{array}{cc} 1 & 0 \\ 0 & 1 \\ 1 & -R \\ 0 & R \\ 0 & -1 \end{array}\right] \left\{\frac{\left[ \begin{array}{c} (1/C)s+R/(LC) \\ +1/(LC) \end{array}\right]}{s^2 + (R/L)s +1/(LC)}\right\} + \left[\begin{array}{c} 0 \\ 0 \\ 0 \\ 0 \\ 1 \end{array} \right]\end{equation*}\end{split}\]
\[\begin{split}\begin{equation*} = \frac{1}{s^2 + (R/L)s +1/(LC)}\left[\begin{array}{c} (1/C)s+R/(LC) \\ 1/(LC) \\ (1/C)s \\ R/(LC) \\ -1/(LC) \end{array}\right] + \left[\begin{array}{c} 0 \\ 0 \\ 0 \\ 0 \\ 1 \end{array} \right]\end{equation*}\end{split}\]
\[\begin{split}\begin{equation*} = \left[\begin{array}{c} \frac{(1/C)s+R/(LC)}{s^2 + (R/L)s +1/(LC)} \\ \frac{1/(LC)}{s^2 + (R/L)s +1/(LC)} \\ \frac{(1/C)s}{s^2 + (R/L)s +1/(LC)} \\ \frac{R/(LC)}{s^2 + (R/L)s +1/(LC)} \\ -\frac{1/(LC)}{s^2 + (R/L)s +1/(LC)}+1 \end{array}\right]\end{equation*}\end{split}\]

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

\[V_{31}= \frac{(1/C)s+R/(LC)}{s^2 + (R/L)s +1/(LC)}\ U.\]

7.2.2.3. Transform Equations for Example

\[\begin{split}\begin{eqnarray*} \mathbf{Y}(s)&=&\left[\mathbf{C}\left[s\mathbf{I}-\mathbf{A}\right]^{-1}\mathbf{B}+\mathbf{D}\right]\mathbf{U}(s)\\ \mathbf{Y}(s) &=& \mathbf{G}(s)\mathbf{U}(s)\end{eqnarray*}\end{split}\]
\[\begin{split}\begin{eqnarray*}\left[\begin{array}{c} V_{31}(s) \\ I_1(s) \\ V_{32}(s) \\ V_{21}(s) \\ I_{2}(s) \end{array}\right] &=& \left[\begin{array}{c} \frac{(1/C)s+R/(LC)}{s^2 + (R/L)s +1/(LC)} \\ \frac{1/(LC)}{s^2 + (R/L)s +1/(LC)} \\ \frac{(1/C)s}{s^2 + (R/L)s +1/(LC)} \\ \frac{R/(LC)}{s^2 + (R/L)s +1/(LC)} \\ -\frac{1/(LC)}{s^2 + (R/L)s +1/(LC)}+1 \end{array}\right]\mathbf{U}(s).\end{eqnarray*}\end{split}\]

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

\[\begin{split}\begin{eqnarray*} I_2 & = & \left(-\frac{1/(LC)}{s^2 + (R/L)s +1/(LC)}+1\right)U\\ & = & \frac{-1/{LC}+s^2 + (R/L)s +1/(LC)}{s^2 + (R/L)s +1/(LC)}\ U \\ & = &\frac{s^2 + (R/L)s}{s^2 + (R/L)s +1/(LC)}\ U\end{eqnarray*}\end{split}\]

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)
../../_images/tf4ss_47_0.svg

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:

\[\det[s\mathbf{I}-\mathbf{A}]\]

This evaluates to the denominator polynomial and the poles of the system are the roots of the system’s characteristic equation:

\[\det[s\mathbf{I}-\mathbf{A}] = 0.\]

The system poles are solutions to the system’s characteristic equation

\[\det[s\mathbf{I}-\mathbf{A}] = 0.\]

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:

\[\begin{split}\left[ {\begin{array}{*{20}c} {s{\bf{I}} - {\bf{A}}} & \vdots & {\bf{B}} \\ \cdots & \cdots & \cdots \\ {\bf{C}} & \vdots & d \\ \end{array}} \right]\left[ {\begin{array}{*{20}c} {\bf{X}} \\ \cdots \\ U \\ \end{array}} \right] = \left[ {\begin{array}{*{20}c} {\bf{0}} \\ \cdots \\ 0 \\ \end{array}} \right]\end{split}\]

The only way this can have non-zero solutions in \(\mathbf{X}\) and \(U\) is if:

\[\begin{split}\det \left[ {\begin{array}{*{20}c} {s{\bf{I}} - {\bf{A}}} & \vdots & {\bf{B}} \\ \cdots & \cdots & \cdots \\ {\bf{C}} & \vdots & d \\ \end{array}} \right] = 0\end{split}\]

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:

\[\begin{split}\frac{Y(s)}{U(s)} = \frac{\det \left[ \begin{array}{*{20}c} s\bf{I} - \bf{A} & \vdots & \bf{B} \\ \cdots & \cdots & \cdots \\ \bf{C} & \vdots & d \\ \end{array} \right]}{\det [s\bf{I} - \bf{A}]}\end{split}\]

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

  1. \(\epsilon(t)\) is the unit step function \(\epsilon(t)=0\) for \(t < 0\); \(\epsilon(t)=1\) for \(t \ge 0\).