Signal Processing Toolbox    
cremez

Complex and nonlinear-phase equiripple FIR filter design

Syntax

Description

cremez allows arbitrary frequency-domain constraints to be specified for the design of a possibly complex FIR filter. The Chebyshev (or minimax) filter error is optimized, producing equiripple FIR filter designs.

b = cremez(n,f,'fresp') returns a length n+1 FIR filter with the best approximation to the desired frequency response as returned by function fresp. f is a vector of frequency band edge pairs, specified in the range -1 and 1, where 1 corresponds to the normalized Nyquist frequency. The frequencies must be in increasing order, and f must have even length. The frequency bands span f(k) to f(k+1) for k odd; the intervals f(k+1) to f(k+2) for k odd are "transition bands" or "don't care" regions during optimization.

b = cremez(n,f,'fresp',w) uses the real, non-negative weights in vector w to weight the fit in each frequency band. The length of w is half the length of f, so there is exactly one weight per band.

b = cremez(n,f,{'fresp',p1,p2,...},...) supplies optional parameters p1, p2, ..., to the frequency response function fresp. Predefined 'fresp' frequency response functions are included for a number of common filter designs, as described below. For all of the predefined frequency response functions, the symmetry option 'sym' defaults to 'even' if no negative frequencies are contained in f and d = 0; otherwise 'sym' defaults to 'none'. (See the 'sym' option below for details.) For all of the predefined frequency response functions, d specifies a group-delay offset such that the filter response has a group delay of n/2+d in units of the sample interval. Negative values create less delay; positive values create more delay. By default d = 0:

b = cremez(n,f,a,w) is a synonym for b = cremez(n,f,{'multiband',a},w).

b = cremez(...,'sym') imposes a symmetry constraint on the impulse response of the design, where 'sym' may be one of the following:

If any 'sym' option other than 'none' is specified, the band edges should only be specified over positive frequencies; the negative frequency region is filled in from symmetry. If a 'sym' option is not specified, the fresp function is queried for a default setting.

b = cremez(...,'skip_stage2') disables the second-stage optimization algorithm, which executes only when cremez determines that an optimal solution has not been reached by the standard Remez error-exchange. Disabling this algorithm may increase the speed of computation, but may incur a reduction in accuracy. By default, the second-stage optimization is enabled.

b = cremez(...,'debug') enables the display of intermediate results during the filter design, where 'debug' may be one of 'trace', 'plots', 'both', or 'off'. By default it is set to 'off'.

b = cremez(...,{lgrid}) uses the integer lgrid to control the density of the frequency grid, which has roughly 2^nextpow2(lgrid*n) frequency points. The default value for lgrid is 25. Note that the {lgrid} argument must be a 1-by-1 cell array.

Any combination of the 'sym', 'skip_stage2', 'debug', and {lgrid} options may be specified.

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

[b,delta,opt] = cremez(...) returns a structure opt of optional results computed by cremez and contains 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.iextr
Vector of indices into opt.fgrid for extremal frequencies
opt.fextr
Vector of extremal frequencies

User-definable functions may be used, instead of the predefined frequency response functions for fresp. The function is called from within cremez using the following syntax

where:

Additionally, a preliminary call is made to fresp to determine the default symmetry property 'sym'. This call is made using the syntax:

The arguments may be used in determining an appropriate symmetry default as necessary. The function private/lowpass.m may be useful as a template for generating new frequency response functions.

Examples

Example 1

Design a 31-tap, linear-phase, lowpass filter:

Example 2

Design a nonlinear-phase allpass FIR filter:

Vector d now contains the complex frequency response that we desire for the FIR filter computed by cremez.

Now compute the FIR filter that best approximates this response:

Algorithm

An extended version of the Remez exchange method is implemented for the complex case. This exchange method obtains the optimal filter when the equiripple nature of the filter is restricted to have n+2 extremals. When it does not converge, the algorithm switches to an ascent-descent algorithm that takes over to finish the convergence to the optimal solution. See the references for further details.

See Also

fir1, fir2, firls, remez

References

[1] Karam, L.J., and J.H. McClellan. "Complex Chebyshev Approximation for FIR Filter Design." IEEE Trans. on Circuits and Systems II. March 1995. Pgs. 207-216.

[2] Karam, L.J. Design of Complex Digital FIR Filters in the Chebyshev Sense. Ph.D. Thesis, Georgia Institute of Technology, March 1995.

[3] Demjanjov, V.F., and V.N. Malozemov. Introduction to Minimax. New York: John Wiley & Sons, 1974.


  cplxpair csd