DSPRelated.com
Free Books

Converting to State-Space Form by Hand

Converting a digital filter to state-space form is easy because there are various ``canonical forms'' for state-space models which can be written by inspection given the strictly proper transfer-function coefficients.

The canonical forms useful for transfer-function to state-space conversion are controller canonical form (also called control or controllable canonical form) and observer canonical form (or observable canonical form) [28, p. 80], [37]. These names come from the field of control theory [28] which is concerned with designing feedback laws to control the dynamics of real-world physical systems. State-space models are used extensively in the control field to model physical systems.

The name ``controller canonical form'' reflects the fact that the input signal can ``drive'' all modes (poles) of the system. In the language of control theory, we may say that all of the system poles are controllable from the input $ u(n)$. In observer canonical form, all modes are guaranteed to be observable. Controllability and observability of a state-space model are discussed further in §G.7.3 below.

The following procedure converts any causal LTI digital filter into state-space form:

  1. Determine the filter transfer function $ H(z)=B(z)/A(z)$.
  2. If $ H(z)$ is not strictly proper ($ b_0\ne 0$), ``pull out'' the delay-free path to obtain a feed-through gain $ b_0$ in parallel with a strictly proper transfer function.
  3. Write down the state-space representation by inspection using controller canonical form for the strictly proper transfer function. (Or use the matlab function tf2ss.)

We now elaborate on these steps for the general case:

  1. The general causal IIR filter
    $\displaystyle y(n) = b_0\,u(n)
$ $\displaystyle +$ $\displaystyle b_1\,u(n-1) +\,\cdots\, + b_{N_b}\,u(n-{N_b})$ (G.8)
    $\displaystyle $ $\displaystyle -$ $\displaystyle a_1\,y(n-1) - \,\cdots\, -a_{N_a}\,y(n-{N_a})
\protect$ (G.9)

    has transfer function

    $\displaystyle H(z) \isdef \frac{Y(z)}{U(z)} = \frac{b_0 + b_1\,z^{-1} +\,\cdots...
..._b}\,z^{-{N_b}} }{ 1 + a_1\,z^{-1} + \,\cdots\, +a_{N_a}\,z^{-{N_a}}}. \protect$ (G.10)

  2. By convention, state-space descriptions handle any delay-free path from input to output via the direct-path coefficient $ D$ in Eq.$ \,$(G.1). This is natural because the delay-free path does not affect the state of the system.

    A causal filter contains a delay-free path if its impulse response $ h(n)$ is nonzero at time zero, i.e., if $ h(0)\neq
0$.G.5 In such cases, we must ``pull out'' the delay-free path in order to implement it in parallel, setting $ D=h(0)=b_0$ in the state-space model.

    In our example, one step of long division yields

    $\displaystyle H(z)$ $\displaystyle =$ $\displaystyle b_0 +
\frac{(b_1 - b_0 a_1)\,z^{-1} +\,\cdots\, + (b_N - b_0 a_N)\,z^{-N} }{
1 + a_1\,z^{-1} + \,\cdots\, +a_{N_a}\,z^{-{N_a}}},$  
      $\displaystyle \isdef$ $\displaystyle b_0 +
\frac{\beta_1\,z^{-1} +\,\cdots\, + \beta_N\,z^{-N}}{
1 + a_1\,z^{-1} + \,\cdots\, +a_{N_a}\,z^{-{N_a}}},
\protect$ (G.11)

    where $ N\isdef \max(N_a,N_b)$, with $ a_i\isdef 0$ for $ i>{N_a}$, and $ b_i\isdef 0$ for $ i>{N_b}$.

  3. The controller canonical form is then easily written as follows:
    $\displaystyle A$ $\displaystyle =$ \begin{displaymath}\left[
\begin{array}{ccccc}
-a_1 & -a_2 & \cdots & -a_{N-1} &...
...\ [2pt] 0 \\ [2pt] \vdots\\ [2pt] 0\end{array}\right]
\nonumber\end{displaymath}  
    $\displaystyle C$ $\displaystyle =$ $\displaystyle \left[\begin{array}{cccc} \beta_1 & \beta_2 & \cdots & \beta_N \end{array}\right]\qquad
D = b_0
\protect$ (G.12)

    An alternate controller canonical form is obtained by applying the similarity transformation (see §G.8 below) which simply reverses the order of the state variables. Any permutation of the state variables would similarly yield a controllable form. The transpose of a controllable form is an observable form.

One might worry that choosing controller canonical form may result in unobservable modes. However, this will not happen if $ B(z)$ and $ A(z)$ have no common factors. In other words, if there are no pole-zero cancellations in the transfer function $ H(z)=B(z)/A(z)$, then either controller or observer canonical form will yield a controllable and observable state-space model.

We now illustrate these steps using the example of Eq.$ \,$(G.7):

  1. The transfer function can be written, by inspection, as

    $\displaystyle H(z) = \frac{1 + 2 z^{-1}+ 3 z^{-2}}{1 + \frac{1}{2}z^{-1}+ \frac{1}{3}z^{-2}}. \protect$ (G.13)

  2. We need to convert Eq.$ \,$(G.13) to the form

    $\displaystyle H(z) = b_0 + \frac{\beta_1 z^{-1}+ \beta_2 z^{-2}}{1 + \frac{1}{2}z^{-1}+ \frac{1}{3}z^{-2}}. \protect$ (G.14)

    Obtaining a common denominator and equating numerator coefficients with Eq.$ \,$(G.13) yields
    $\displaystyle b_0$ $\displaystyle =$ $\displaystyle 1,$  
    $\displaystyle \beta_1$ $\displaystyle =$ $\displaystyle 2 - \frac{1}{2}= \frac{3}{2},$ and  
    $\displaystyle \beta_2$ $\displaystyle =$ $\displaystyle 3 - \frac{1}{3}= \frac{8}{3}.
\protect$ (G.15)

    The same result is obtained using long division (or synthetic division).

  3. Finally, the controller canonical form is given by
    $\displaystyle A$ $\displaystyle \isdef$ $\displaystyle \left[\begin{array}{cc} -\frac{1}{2} & -\frac{1}{3} \\ [2pt] 1 & 0 \end{array}\right]$  
    $\displaystyle B$ $\displaystyle \isdef$ $\displaystyle \left[\begin{array}{c} 1 \\ [2pt] 0 \end{array}\right]$  
    $\displaystyle C^T$ $\displaystyle \isdef$ $\displaystyle \left[\begin{array}{cc} 3/2 & 8/3 \end{array}\right]$  
    $\displaystyle D$ $\displaystyle \isdef$ $\displaystyle 1.
\protect$ (G.16)


Next Section:
Converting Signal Flow Graphs to State-Space Form by Hand
Previous Section:
Example State Space Filter Transfer Function