Filter Approximation
Digital filter design problems consist of two parts, approximation and realization. This section discusses the PV‑WAVE Signal Processing Toolkit functions for approximating digital filters. The Filter Realization section discusses the routines for realizing digital filters.
Digital filter approximation problems consist of selecting the coefficients of the rational transfer function H(z):
in order to achieve some desired result when the filter is applied to a signal. All of the filter approximation routines in the PV‑WAVE Signal Processing Toolkit return the filter coefficients in a digital filter data structure.
Classical FIR and IIR Filter Approximation
Classical FIR and IIR filter approximation problems concern the approximation of the ideal lowpass, highpass, bandpass, and bandstop filters as illustrated in Figure 1-2: Ideal Filter for FIR and IIR Filter Approximation.
 
Figure 1-2: Ideal Filter for FIR and IIR Filter Approximation
A summary of PV‑WAVE Signal Processing Toolkit functions for solving classical filter design problems is listed in the following table. FIR and IIR filter approximations use separate functions in the Signal Processing Toolkit. For detailed information, see Chapter 2: Reference (A to F) and Chapter 3: Reference (G to P).
 
Classical Filter Approximation Functions  
Function
Description
BILINTRANS (*)
Bilinear transform
FIRDESIGN (*)
FIR lowpass, highpass, bandpass, bandstop filter design
FIRLS (*)
FIR multiple bandpass FIR filter design
FIRWIN
FIR window functions
FREQTRANS (*)
IIR filter frequency transformation
FREQTRANSDESIGN
IIR filter frequency transformation design for multiple bandpass IIR filter design
IIRDESIGN (*)
IIR Butterworth, Chebyshev I,  Chebyshev II, and elliptic filter design
IIRORDER
IIR filter order estimation
*   function uses the digital filter data structure
FIR Filter Approximation
The classical approach to FIR filter design uses window functions. This approach first determines the inverse Fourier transform of the ideal filter frequency response:
and then multiplies this response by an appropriate window function.
The following example illustrates the design of a windowed bandpass filter. Figure 1-3: Windowed Bandpass Filter Frequency Response shows the resulting filter frequency response.
; Computes a window sequence.
w = FIRWIN(55, /Blackman)
; Design a windowed FIR filter with normalized cutoff frequencies
; of 0.33 and 0.66.
h = FIRDESIGN(w, 0.33, 0.66, /Bandpass)
hf = FREQRESP_Z(h, Outfreq = f)
; Plot the magnitude of the filter frequency response.
PLOT, f, ABS(hf)
 
Figure 1-3: Windowed Bandpass Filter Frequency Response
IIR Filter Approximation
One of the key features of the PV‑WAVE Signal Processing Toolkit is the flexibility of IIR filter design which results from the approach used in applying transformations in IIR filter design. This approach enables you to design all of the filters in the classical approach, and has the added advantage of simplifying the design of multiple bandpass filters.
The classical approach to IIR filter design starts with an analog lowpass filter prototype and then applies various frequency transformations to arrive at the desired digital filter. There are two approaches to applying transformations to an analog lowpass filter prototype as illustrated in Figure 1-4: Transformation Application Approaches. The top path in the figure illustrates the standard approach taken in IIR filter design, and the bottom path illustrates the alternate approach used in the PV‑WAVE Signal Processing Toolkit.
 
Figure 1-4: Transformation Application Approaches
The Standard IIR Approximation Approach
The approach illustrated in the top path of Figure 1-4: Transformation Application Approaches is the approach most often employed by signal processors. This standard approach first transforms the analog lowpass filter prototype HLP(s) into an appropriate lowpass, highpass, bandpass, or bandstop filter
and then uses the bilinear transform to obtain a digital filter H(z).
The PV‑WAVE Signal Processing Toolkit Approach
The approach used in the Signal Processing Toolkit is shown in the bottom path in Figure 1-4: Transformation Application Approaches. This alternate approach can design all of the filters available using the standard approach, but has the added advantage of simplifying multiple bandpass filter design. This approach first transforms the analog lowpass filter prototype HLP(s) into a digital lowpass filter prototype:
using the bilinear transform. Then a frequency transformation is applied to obtain an appropriate lowpass, highpass, bandpass, or bandstop digital filter H(z).
The following example illustrates the ease in designing a multiple bandpass elliptic filter using the PV‑WAVE Signal Processing Toolkit.
!P.Multi = [0, 1, 2]
hlp = IIRDESIGN(3, 0.5, 0.1, 0.1, /Ellip)
hlpf = FREQRESP_Z(hlp, Outfreq = f)
; Plot magnitude frequency response of lowpass filter prototype.
PLOT, f, ABS(hlpf), Title = 'Lowpass Prototype Filter'
; Design frequency transformation for multiple bandpass filter 
; with frequency band edges of 0.1, 0.3, 0.4, 0.6, and 0.8.
p = FREQTRANSDESIGN([.1, .3, .4, .6, .8])
; Apply frequency transformation to lowpass filter prototype.
hbp = FREQTRANS(hlp, p)
hbpf = FREQRESP_Z(hbp, Outfreq = f)
; Plot the magnitude response of the multiple bandpass filter.
PLOT, f, ABS(hbpf), Title = 'Multiple Bandpass Filter'
In Figure 1-5: Multiple Bandpass Filter, (a) shows the magnitude frequency response of the original lowpass filter, and (b) shows the response after applying the frequency transformation to obtain the multiple bandpass filter.
Figure 1-5: Multiple Bandpass Filter
Advanced and Multirate Filter Approximation
The PV‑WAVE Signal Processing Toolkit also includes several advanced filter approximation functions and multirate filter approximation functions.
The advanced filter approximation functions produce filters that are optimal subject to various constraints, such as least-squares error criteria, Chebyshev error criteria, and moment preserving criteria.The least-squares filter approximation functions shown in Table 1-4: Advanced Filter Approximation Functions can also be used to obtain filters that interpolate a given set of impulse or frequency response values. For detailed information, see Chapter 2: Reference (A to F), Chapter 3: Reference (G to P), and Chapter 4: Reference (Q to Z).
 
Advanced Filter Approximation Functions
Function
Description
FIRLS (*)
Frequency domain least-squares FIR filter design
IIRLS (*)
Frequency and time domain least-squares filter design
REMEZ (*)
Optimal Chebyshev error FIR filter design (Parks-McClellan algorithm)
SGFDESIGN (*)
Optimal Savitsky-Golay FIR filter design
*   function uses digital filter data structure
Table 1-5: Multirate Filter Approximation Functions shows the list of multirate filter approximation functions that produce filters which are used in standard multirate filtering operations such as decimation and interpolation. For detailed information, see Chapter 2: Reference (A to F) and Chapter 4: Reference (Q to Z)..
 
Multirate Filter Approximation Functions
Function
Description
FILTDOWNDESIGN (*)
Decimation filter design
FILTUPDESIGN (*)
Interpolation filter design
QMFDESIGN (*)
Quadrature mirror filter design
*   function uses digital filter data structure