Personal tools
  •  
You are here: Home Electrical and Computer Engineering Signals and Systems Lecture 2 : System Realization

Lecture 2 : System Realization

Document Actions
  • Content View
  • Bookmarks
  • CourseFeed
Schedule :: Intro :: Inverse :: Properties :: Solution :: Transfer Functions :: System Realization :: Bilateral :: Frequency Response :: Rubber Sheet Geometry :: FIR Filters

All of the block diagram operations we talked about with respect to Laplace transforms still apply. Series (cascade), parallel, and feedback configurations all have the same block diagram simplifications.

The same techniques we used for ``system realization'' of Laplace transforms still apply for Z-transforms. The only difference is to substitute $z^{-1}$ for $\frac{1}{s}$ . Even though the diagram ends up the same, there may be understanding to be gained by working through the steps. As before, we will take an example of a third order transfer function

\begin{displaymath}H[z] = \frac{b_3z^3 + b_2z^2 + b_1 z + b_0}
{z^3 + a_2z^2 + a_1 a + a_0} \end{displaymath}

Break this into two pieces: Let
\begin{displaymath}X[z] = \frac{1}{z^3 + a_2z^2 + a_1 a + a_0}F[z] \end{displaymath}

and let
\begin{displaymath}Y[z] = X[z](b_3z^3 + b_2z^2 + b_1 z + b_0) \end{displaymath}

From $X[z]$ we can write
\begin{displaymath}z^3 X[z] + a_2z^2 X[z] + a_1 z X[z] + z_0 X[z] = F[z] \end{displaymath}
\begin{displaymath}z^3 X[z] = - a_2z^2 X[z] - a_1 z X[z] - z_0 X[z] + F[z] \end{displaymath}
Draw a block diagram. Then we connect the rest of the pieces to get $Y[z]$ .

\begin{example}Draw a system realization for
\begin{displaymath}H[z] = \frac{z + 2}{z^2 + 5z + 1} \end{displaymath}\end{example}
Note that in FIR filters the output depends only on the current and previous inputs. In IIR filters, the output depends on these and also on prior outputs -- there is some kind of feedback. It is this feedback that gives them their infinite response.

This realization is useful in a sort of theoretical sense, and gives us a map of what is going on. But, unlike for continuous-time systems, there is no practical way of doing this using resistors, capacitors, and op-amps. What the diagram really represents is a computer program . We will now talk about how this is done. We will start first with an FIR filter. Consider the particular example of

\begin{displaymath}H[z] = 2 + 3z^{-1} + 4z^{-2} + 5z^{-3} \end{displaymath}
Then
\begin{displaymath}Y[z] = H[z]F[z] = (2 + 3z^{-1} + 4z^{-2} + 5z^{-3})F[z]. \end{displaymath}

Transforming back,
\begin{displaymath}y[k] = 2f[k] + 3f[k-1] + 4f[k-2] + 5f[k-3] \end{displaymath}
Draw the block diagram. The equation tells us how to program it. First, we need some way of keeping track of the previous values. Let is keep these in an array called fprevious , and set it up so that fprevious[0] is the current value of $f$ , fprevious[1] is the last value of $f$ , and so on. Furthermore, let is keep track of the coefficients in an array called coefficient , set up as follows:
            coefficient[0] = 2;
coefficient[1] = 3;
coefficient[2] = 4;
coefficient[3] = 5;
           

Now we will create a filtering routine, and pass the coefficients into it. Note: this code is provided for demonstration purposes only. It may have minor problems with it that the student is expected to be able to understand and correct.

1firfilt1.c

This computes the output and shifts everything down. Note that we have to save the previous values of the outputs so they can be used for the next call to the filter. This has problems -- suppose you have more than one filter -- how do you keep things from getting messed up. Perhaps a cleaner way to do this would be to pass in the previous values to the filter. The cleanest way is probably to use C++ with a constructor that keeps a separate data set for each instantiation of the filter class. I will leave these finessings to the diligent student.

To generalize our simple filter routine, let us allow different numbers of coefficients to be passed in. This means that we have to allocate sufficient space for the previous values, and add everything up in a loop. 1firfilt2.c

For the diligent students interested in speeding things up as much as possible, I pose the following ideas:

  1. Can the filter loop and the shift loop be combined, so that only one loop needs to be execute to accomplish both functions?
  2. The shifting operation is slow and unnecessary. How could you use a circular queue to store the previous values so that the shifting operation is no longer necessary?

Enough about FIR filters. Implementing IIR filters will also be addressed by means of an example. We want to implement the filter represented by

\begin{displaymath}H[z] = \frac{6z^2 + 2z + 3}{z^2 + 4z + 5} \end{displaymath}
\begin{displaymath}Y[z] = H[z]F[z] \end{displaymath}
\begin{displaymath}(z^2 + 4z + 5)Y[z] = (6z^2 + 2z+3)F[z] \end{displaymath}
In the time domain,
\begin{displaymath}y[k+2] + 4y[k+1] + 5y[k] = 6f[k+2] + 2f[k+1] + 3f[k] \end{displaymath}

Shifting in time and solving for $y[k]$ ,

\begin{displaymath}y[k] = -4y[k-1] - 5y[k-2] + 6f[k] + 2f[k-1] + 3f[k-2] \end{displaymath}
Again, we have a formula for the filter output. Assume that the numerator coefficients are stored in an array numcoeff and the denominator coefficients are stored in an array dencoeff :
            numcoeff[0] = 6;
numcoeff[1] = 2;               dencoeff[1] = -4;
numcoeff[2] = 3;               dencoeff[2] = -5;
           
Caution : note that the denominator coefficients are the negative of the coefficients in the original transfer function. We will keep the previous input values in an array fprevious and keep previous output values in an array yprevious . 1iirfilt1.c

As before, we will generalize this to arbitrary transfer functions of denominator degree degree : 1iirfilt2.c Again, speedups are attainable: merge the shift loop into the filter loop, or get rid of shifting entirely by using a circular queue.

Copyright 2008, by the Contributing Authors. Cite/attribute Resource . admin. (2006, May 18). Lecture 2 : System Realization. Retrieved January 07, 2011, from Free Online Course Materials — USU OpenCourseWare Web site: http://ocw.usu.edu/Electrical_and_Computer_Engineering/Signals_and_Systems/node6.html. This work is licensed under a Creative Commons License Creative Commons License