source code in HTML
source code in PDF

Design a digital filter using locations of poles and zeros

Nasser M. Abbasi

April 13 2009 compiled on — Wednesday July 06, 2016 at 08:30 AM

1 Introduction

This demonstration shows visually how the locations of poles and zeros of the system transfer function affect the system properties. Using the mouse you can drag a pole or a zeros of a discrete system transfer function H(z) to a different location and observe the effect on the system.

H (z) = Y(z)
        X(z)   represents the transfer function of a discrete time system where Y(z)  is the Z  transform of the output signal and X (z)  is the Z  transform of the input signal. Writing H(z)  as a ratio of two polynomials in z  , the poles of H (z)  are the roots of the denominator polynomial and the zeros are the roots of the numerator polynomial.

This demonstration uses the new control system functions added to Mathematica 8.0 in the implementation. The continuous time transfer function approximation H (s)  is generated using all supported H (z)  to H (s)  mapping methods in Mathematica 8. The mapping of the z  plane to the s  plane is also generated.

A total of 12 different plots are available to examine as you move the poles and zeros to different locations.

2 Using the program

There are 3 parts to the main display: The left part represents the domain of H (z)  and shows the unit circle where the poles and zeros can be dragged using the mouse. The right side of the display is used to show different plots such as Bode and system response to different inputs. The top part of the display shows the generated analytical expression for H (z)  and H (s)  and the differential equation that represents the inverse Laplace transform of the denominator of the transfer function H (s)  .

In this demonstration it is assumed that the system is causal and right sided which implies that the system is stable when all the poles are inside the unit circle and hence the ROC (region of convergence) extends from the largest pole to infinity. Therefore, the system will be stable when the ROC contains the unit circle.

The following is a description of how to use this demonstration: Starting at the left side of the display, we see the unit circle surrounded by a small gray area. Poles and zeros that are inside the gray area do not contribute at all to the system. A pole is marked with imes  and a zero is marked with a ∘ .

To add a pole or a zero to the system, simply drag the pole or the zero from the gray area to the white area using the mouse. To remove a pole or a zero from the system, drag it back to the gray area. All operations are done using the mouse only. The keyboard is not used.

To drag a pole, the radio button selection at the top left of the display must be set to pole. Similarly, to drag a zero, the selection should be set to zero. Dragging is active only in the upper half of the diagram. Complex conjugate poles and zeros in the lower half are automatically created, removed and dragged with the upper half poles and zeros.

To keep the display small, the active area where poles and zeros can be located extend from − 1.2  to + 1.2  in both the x  and y  directions. This is the white area surrounded by the gray area. The gray area is used only to keep poles and zeros that are not being used at the moment.

The following is a description of the controls in the top of the demonstration from left to right: The radio buttons labeled 'pole' and 'zero' are used to select the type of the root to move (a pole or zero). For example, If you try to drag a pole when the selection is set to 'zero' it will have no effect.

Next is a popup menu labeled plot type which is used to select which plot to show in the right side of the display. The slider labeled 'f' represents the forcing frequency in units of hz  for the input signal which is used when selecting the last 2  choices in the 'plot type' popup menu.

The slider labeled k is the root locus gain parameter used in the Mathematica RootLocusPlot command.

The next 2 popup menus are used to select the units for the Bode plot. The Mathematica BodePlot command contains more description of these units. The checkbox labeled gridline is used to turn on grid lines for the plots generated in the right side of the display. The checkbox labeled margins is used to add the option StabilityMargins to BodePlot, NyquistPlot and NicholsPlot. The checkbox labeled closed loop is used to generate the closed loop system and use that instead of the open loop system.

By using this option the system -H-(z)-
1+H (z)   will be used instead of H (z)  in all the analysis except for the RootLocusPlot where the open loop transfer function H (z )  is used.

The following is a description of the controls located in the bottom side of the demonstration from left to right: The checkbox labeled background is used to show the fine grid dots shown in the domain of the H (z)  . The checkbox labeled tooltip is used to turn on the tooltip support which allows you to view the system frequency as you move the mouse around the perimeter of the unit circle and shows the corresponding location on the Bode plots (if it is selected at the same time). Therefore to see this in action, start by selecting the Bode plot option, then turn on the tooltip checkbox, then move the mouse near the edge of the unit circle.

When the tooltip is active, dragging of poles and zeros is disabled automatically. To drag poles and zeros again, make sure the tooltip is checked off. The popup menu labeled grid spacing is used to select the grid spacing for locating poles and zeros. By default, poles and zeros will be located only at intervals of 0.1  distance from each others.

This is the default grid granularity. This allows better control on the location of poles and zeros. By setting this option to 0  , you can position poles and zeros any where and not only at the grid points, however this could make it harder to position more than one pole or zero at the exact same location depending on the mouse sensitivity.

When the same physical location contain more than one pole or one zero, the order is shown in smaller text next to the location. Putting a zero on top of a pole do not cause a pole zero cancellation in this demonstration.

The slider labeled time is used to specify the time duration for the response of the system in seconds. The slider labeled Ts  is the sampling period in seconds used in the conversion of the discrete system to continuous system. The check box labeled joined plot is used to change the display of the response of the discrete system. The check box labeled superimpose is used to show the continuous response of the system with the discrete response on the same plot. The popup menu labeled conversion method is used to select the method to convert H (z)  to H (s)  .

Mathematica documentation contains more information on these conversion methods. Finally the button labeled init is used to initialize the demonstration to the original settings.

3 Additional information

In some cases (such as with marginal stability) the magnitude bode plot might not be generated. The plots of Nyquist, Nichlos and Root locus are all plots of the discrete system.

In the response plots, the dashed black line represents the input to the system (step, ramp, sinusoidal, or the exponential decaying sinusoidal). The red line is the discrete system response, and the blue line is the response of the continuous time approximation of the discrete system.

Nichlos plot is plotted using degrees for phase units and absolute for the magnitude.

The S-plane map plot shows the poles and zeros locations in the Laplace domain corresponding to the poles and zeros in the z  domain. Moving the mouse close to a pole in the s  -domain displays the damping ratio ζ  and the natural frequency ω  corresponding to this pole.

This demonstration supports a maximum of 8 poles and 8 zeros.

4 References

  1. Alan V. Oppenheim and Ronald W. Schafer, Discrete-time signal processing, Prenctice Hall, NJ. 1999.
  2. Alan V. Oppenheim and Ronald W. Schafer, Digital Signal processing, Prenctice Hall, NJ. 1975.