Signal Processing Toolbox
  Go to function:
    Search    Help Desk 
remez    Examples   See Also

Parks-McClellan optimal FIR filter design.

Syntax

Description

remez designs a linear-phase FIR filter using the Parks-McClellan algorithm [1]. The Parks-McClellan algorithm uses the Remez exchange algorithm and Chebyshev approximation theory to design filters with an optimal fit between the desired and actual frequency responses. The filters are optimal in the sense that the maximum error between the desired frequency response and the actual frequency response is minimized. Filters designed this way exhibit an equiripple behavior in their frequency responses and hence are sometimes called equiripple filters.

b = remez(n,f,a) returns row vector b containing the n+1 coefficients of the order n FIR filter whose frequency-amplitude characteristics match those given by vectors f and a.

The output filter coefficients (taps) in b obey the symmetry relation

Vectors f and a specify the frequency-magnitude characteristics of the filter:

The relationship between the f and a vectors in defining a desired frequency response is shown below:


remez(n,f,a,w) uses the weights in vector w to weight the fit in each frequency band. The length of w is half the length of f and a, so there is exactly one weight per band.

b = remez(n,f,a,'ftype') and

b = remez(n,f,a,w,'ftype') specify a filter type, where ftype is

b = remez(...,{lgrid}) uses the integer lgrid to control the density of the frequency grid, which has roughly (lgrid*n)/(2*bw) frequency points, where bw is the fraction of the total frequency band interval [0,1] covered by f. Increasing lgrid often results in filters that are more exactly equiripple, but which take longer to compute. The default value of 16 is the minimum value that should be specified for lgrid. Note that the {lgrid} argument must be a 1-by-1 cell array.

b = remez(n,f,'fresp',w) returns row vector b containing the n+1 coefficients of the order n FIR filter whose frequency-amplitude characteristics best approximate the response specified by function fresp. The function is called from within remez with the following syntax:

The arguments are similar to those for remez:

The predefined frequency response function (fresp) that remez calls is remezfrf in the signal/private directory.

b = remez(n,f,{'fresp',p1,p2,...},w) allows you to specify additional parameters (p1, p2, etc.) to pass to fresp. Note that b = remez(n,f,a,w) is a synonym for b = remez(n,f,{'remezfrf',a},w), where a is a vector containing the desired amplitudes at the points specified in f.

b = remez(n,f,'fresp',w,'ftype') and

b = remez(n,f,{'fresp',p1,p2,...},w,'ftype') design antisymmetric (odd) rather than symmetric (even) filters, where 'ftype' is either 'd' for a differentiator or 'h' for a Hilbert transformer.

In the absence of a specification for ftype, a preliminary call is made to fresp to determine the default symmetry property sym. This call is made using the syntax:

The arguments n, f, w, etc., may be used as necessary in determining an appropriate value for sym, which remez expects to be either 'even' or 'odd'. If the fresp function does not support this calling syntax, remez defaults to even symmetry.

[b,delta] = remez(...) returns the maximum ripple height in delta.

[b,delta,opt] = remez(...) returns a structure, opt, of optional results with the following fields.

opt.fgrid
Frequency grid vector used for the filter design optimization
opt.des
Desired frequency response for each point in opt.fgrid
opt.wt
Weighting for each point in opt.fgrid
opt.H
Actual frequency response for each point in opt.fgrid
opt.error
Error at each point in opt.fgrid (opt.des-opt.H)
opt.iextr
Vector of indices into opt.fgrid for extremal frequencies
opt.fextr
Vector of extremal frequencies

Example

Graph the desired and actual frequency responses of a 17th-order Parks-McClellan bandpass filter:

Algorithm

remez is a MEX-file version of the original Fortran code from [1], altered to design arbitrarily long filters with arbitrarily many linear bands.

remez designs type I, II, III, and IV linear-phase filters. Type I and Type II are the defaults for n even and n odd, respectively, while Type III (n even) and Type IV (n odd) are obtained with the 'hilbert' and 'differentiator' flags. The different types of filters have different symmetries and certain constraints on their frequency responses (see [5] for more details).

Linear Phase Filter Type

Filter Order n



Symmetry of Coefficients


Response H(f), f = 0


Response H(f), f = 1 (Nyquist)

Type I
Even
even:



No restriction
No restriction
Type II
Odd
No restriction
H(1) = 0
Type III
Even
odd:



H(0) = 0
H(1) = 0
Type IV
Odd
H(0) = 0
No restriction

Diagnostics

An appropriate diagnostic message is displayed if incorrect arguments are used:

A more serious warning message is

In the rare event that you see this message, it is possible that the filter design may still be correct. Verify the design by checking its frequency response.

See Also

butter
Butterworth analog and digital filter design.
cheby1
Chebyshev type I filter design (passband ripple).
cheby2
Chebyshev type II filter design (stopband ripple).
cremez
Complex and nonlinear-phase equiripple FIR filter design.
ellip
Elliptic (Cauer) filter design.
fir1
Window-based finite impulse response filter design - standard response.
fir2
Window-based finite impulse response filter design - arbitrary response.
fircls
Constrained least square FIR filter design for multiband filters.
fircls1
Constrained least square filter design for lowpass and highpass linear phase FIR filters.
firls
Least square linear-phase FIR filter design.
firrcos
Raised cosine FIR filter design.
remezord
Parks-McClellan optimal FIR filter order estimation.
yulewalk
Recursive digital filter design.

References

[1] IEEE. Programs for Digital Signal Processing. IEEE Press. New York: John Wiley & Sons, 1979. Algorithm 5.1.

[2] IEEE. Selected Papers in Digital Signal Processing, II. IEEE Press. New York: John Wiley & Sons, 1979.

[3] Parks, T.W., and C.S. Burrus. Digital Filter Design. New York: John Wiley & Sons, 1987. Pg. 83.

[4] Rabiner, L.R., J.H. McClellan, and T.W. Parks. "FIR Digital Filter Design Techniques Using Weighted Chebyshev Approximations." Proc. IEEE 63 (1975).

[5] Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. Englewood Cliffs, NJ: Prentice Hall, 1989. Pgs. 256-266.



[ Previous | Help Desk | Next ]