Nuhertz

Digital Filters


Flash Menu
Go Direct to:
Z Transform Outputs
Bilinear, Matched Z, Impulse Invariant, or Step Invariant
Bilinear Prewarping
Sin(X)/X Compensation
Standard, Cascade, and Parallel Forms
Precision and Quantization
Deriving Digital Filters From Z Transforms
Real and Quadruplet Zeros Delay Equalization
On Other Pages:

FIR Filters
Quantization Analysis


Z transform Outputs

Filter Solutions provides you with several output formats for Z transforms. Supported formats include Decimal, unsigned floating binary, signed floating binary, unsigned fixed binary, and signed fixed binary. All binary output formats are encoded in hexadecimal. Signed binary numbers are in twos complement. The number of significant digits may be specified for decimal outputs, the number of significant bits may be specified for binary formats, and the maximum range may be specified for fixed point. All formats are supported by finite precision analysis in Filter Solutions. Z transform coefficients may be copied directly into the windows clipboard either as shown or formatted for Matlab, or sent directly to the "Custom Filter" text windows.

Examples of Z Transform Formats:

Decimal Format
Decimal Format With 8 Significant Digits
Floating Point Binary Format
Signed Floating Binary Format With 32 Significant Bits.
Fixed Point Binary Format
Signed Fixed Binary Format With 32 Significant Bits and Range of 2

Back to Top

 

Bilinear, Matched Z, Impulse Invariant, or Step Invariant

The answer to which digitization technique to use depends on your application. None of the techniques are perfect, but in general the Bilinear transformation maps the entire frequency response of the desired filter, the Impulse Invariant transformation preserves the impulse time response, and the Step Invariant preserves the step time response. So, if you need frequency performance, such as filtering a variable in a dynamic frequency sensitive environment, your best bet is to use the Bilinear transformation. If you need time performance, such as modeling the time response of a disturbance to a plant, your best bet is to use the Impulse Invariant or Step Invariant transformation. The matched Z transform is very basic and has no distinguishing features. When in doubt, go with the Bilinear.

To illustrate the time characteristics of these digitization techniques, here is the step and impulse response trace of a first order one radian/second Butterworth filter followed by a Bilinear transformation, Impulse Invariant transformation, and Step Invariant transformation sampled at 2 Hz.

 

Continuous Step Response
Continuous Step Response

The continuous time response is a nice exponential curve starting at zero and decaying asymptomatically to one and zero as shown above.

 

Bilinear Step Response
Bilinear Step Response

Note the error in the Bilinear trace. The signal's first step is .2, then the second is .3 more. The impulse response is no better. This does not reproduce the desired exponential time response very well!

 

Impulse Invariant Step Response
Impulse Invariant Step Response

With the Impulse Invariant transformation shown above, each sample period exactly matches the impulse response value in the continuous impulse trace. This is a nicely reproduced impulse response for this filter.

 

Impulse Invariant Step Response
Step Invariant Step Response

With the Step Invariant transformation shown above, each sample period exactly matches the step response value in the continuous impulse trace. This is a nicely reproduced step response for this filter.

Back to Top

 

Bilinear Prewarping

The discrete sampling of digital filters produces aliasing for frequencies at or exceeding half the sample rate. In the case of the Bilinear transformation, the entire continuous frequency spectrum is mapped to the discrete unit circle. This produces frequency warping errors throughout the digital frequency response. This error shows up as an incorrect cutoff frequency for low pass and high pass filters, and an incorrect center frequency and band width for band pass and band stop filters. It is generally a design critical practice to sample at least twice as fast as the highest frequency that is expected to pass through the filter so that the effects of frequency warping are minimized.

The following illustration shows the effect of error due to frequency warping and correction by prewarping on a band pass filter with corner frequencies at 9 and 10Hz. The sampling frequency is 25Hz. First, the continuous response is shown:

Continuous Frequency Response
Continuous Band Pass Frequency Response

When digitized with a Bilinear transformation, and sampled at 25Hz, the frequency response exhibits aliasing errors as shown. Note below that the center frequency is now less than 7Hz and the band width is about 1/3Hz. This is way off from the original 9 and 10Hz corner frequencies!

 

Discrete Band Pass Aliasing Error
Discrete Band Pass Aliasing Error

With prewarping techniques, the original pass band frequency response can be preserved as seen below. Note the corner frequencies are back at 9 and 10Hz where we wanted them! The sharp frequency roll off past 10Hz is the expected result of frequency warping.

 

Discrete band Pass With Alias Correction
Discrete Band Pass With Prewarping

Back to Top

Sin(X)/X Compensation

To compensate for Sin(X)/X due to sampling, the option exists to insert an approximate X/Sin(X) into the IIR or FIR Z transform to offset the effect of sampling. Filter Solutions offers 1st, 2nd, and 3rd order compensations that approximate X/Sin(X) and are valid for frequencies up to half the sample rate. The FIR compensator is less accurate than the IIR, but is useful when it is necessary to maintain the FIR characteristic of the filter. You may view the effect of this compensation by viewing the magnitude response of a high pass or band stop filter at half the sample rate. The graph below shows Filter Solutions' 3rd order IIR and FIR compensation against the ideal compensation. More detailed information is available in the Filter Solutions Help file.

IIR Sin(x)/X Compensation
IIR 3rd Order Sin(X)/X Compensation.
Sample Rate = 20 Hz

FIR Sin(x)/X Compensation
FIR 3rd Order Sin(X)/X Compensation.
Sample Rate = 20 Hz

Back to Top

 

Standard, Cascade, and Parallel Form?

With ordinary 64 bit arithmetic, a low pass or high pass filter should work with the standard form if the order is 10 or less. For a band pass or band stop filter, the standard form should work if the order is 5 or less. For filters larger than this, or with fewer bits of precision available, the cascade or parallel form may be necessary. The reason for this is that although the standard form is simpler and easier to build, it introduces and magnifies rounding errors for large filters. The cascade and parallel forms are more complex, but do not introduce as much rounding error. The rounding, or quantization error, increases as the arithmetic precision of the filter decreases. In general, both the parallel and cascade forms provide more stability due to less pole wandering than the standard form. For Bilinear transformations, the cascade form tends to provide better performance than the parallel form. For Impulse Invariant and Step Invariant transformations, the parallel tends to provide better performance than the cascade form.

If you are using Filter Solutions autocode to build your filter, it is just as easy to build a parallel or cascade filter as it is a standard filter. Since there is no additional computer overhead to pay, you may as well use the more complex forms whenever you are in doubt. FIR filters do not have a defined parallel form, and the cascade form provides marginal improvements in performance. Therefore, for FIR filters, only the standard form is supported by Filter Solutions

To illustrate these concepts, a 6th order band stop filter step response from a standard form Z transform, 64 bit arithmetic, is shown below.

 

Standard Form Resulting in Quantization Noise
Standard Form Resulting in Quantization Noise

Obviously, we did not achieve our desired filter effects! Now lets try the same filter design, but in parallel form.

 

Paralle Form With no Noise
Parallel Form With no Noise

We did it! Filter noise will pick up due to high sample rates as well as large orders. Whenever the standard form does not perform due to quantization, the parallel or cascade forms are needed.

Back to Top

 

Precision and Quantization

Not all processors execute digital filters with the same arithmetic precision as your PC. Therefor, the digital time response from the Filter Solutions control panel may not be the same response you get out of your target processor. Filter Solutions provides digital filter test and simulation features to help you determine if your digital filter will execute properly on your target processor. The Z transform page Sim function will execute the time response, frequency response, and pole/zero plot of your digital filter using the same form (Standard, Cascade, or Parallel) and arithmetic precision (Sig Digs entry) that you specify on the page. You must determine the precision of your target processor in terms of significant digits or bits of arithmetic execution, and enter this number in the Sig Digs or Sig Bits box.

If your filter is unstable or contains quantization noise, your options are:

When you have completed your filter study and are ready to generate code for your filter, you must set the Sig Dig box to the desired number of digits (1-16) to display the Z transform in. 16 is recommended for high precision processors.

Back to Top

 

Deriving Digital Filters From Z Transforms

Filter Solutions provides you with a Z transform and C autocode to create your digital filter. If you are not familiar with how to create a digital filter from a Z transform, this is how it works.

The term "Z" refers to inverse past value. Hence Z raised to the -1 power refers to a past value, Z raised to the -2 refers to two past values, etc. Sometimes Z transforms are written in terms of Z to the -1 rather than Z. This requires more notation, but makes it easier to visualize the digital filter. The denominator of the Z transform refers to feedback paths. The numerator refers to feed forward paths. Feed forward paths are positive; feedback paths are always negative. For FIR filters, all the feedback terms in the denominator are zero.

The following table illustrates the conversion of a Z transform from textual to graphical representation for the standard, cascade, and parallel forms. Computer code may be easily written from the graphical implementations.

The Standard Form:

The general fifth order Standard Z transform is:

Standard Z Transform


A simple graphical implementation for this is:

Standard Graphical Form

The Cascade Form:

The general fifth order Cascade Z transform is:

Standard Z Transform

Note that the cascade form is simply the product of first and second order Z transform plus a constant gain. The highest order numerator terms are usually 1 or 0.
A graphical implementation for the cascade form is:

Standard Graphical Form

The Parallel Form:

The general fifth order parallel Z transform is:

Parallel Z Transform


Note that this Z transform is simply the sum of first and second order Z transforms plus a constant offset.

A graphical implementation for the parallel form is:

Standard Graphical Form

Back to Top

 

Real and Quadruplet Zeros Delay Equalization

Phase angle and group delay may be altered by the presence of dual and quadruplet off axis zeros. Unlike all pass stages, the mere addition of dual and quadruplet off-axis zeros also effects the pass band magnitude response, so additional calculations are needed to adjust the pole locations as needed to restore the pass band.  Delay equalization with real and quadruplet zeros result in a flatter Chebyshev pass band and steeper attenuation near the cut off frequency than a comparable size filter equalized with traditional all pass stages.  This may provide a more efficient filter, depending on the specific filter design requirements.

Filter Solutions offers a fast and easy approach to real and quadruplet delay equalization for low pass, high pass, and band pass digital filters.  Poles and group delay are updated in real time in response user zeros manipulation to flatten the pass band back into an equiripple (Chebyshev I) or maximally flat (Butterworth) shape, and digital filters are calculated instantly with the positioned zeros.

Quadruplet Off Axis Delay Equalized Frequency Response     Quadruplet Off Axis Delay Equalized Pole/Zero Plane
Quadruplet Zero Equalized Low Pass Chebyshev Passive Filter, Frequency Response and Pole/Zero Plane
 

Back To Top