## Documentation Center |

Complex and nonlinear-phase equiripple FIR filter design

`b = cfirpm(n,f,@fresp)`

b = cfirpm(n,f,@fresp,w)

b = cfirpm(n,f,a)

b = cfirpm(n,f,a,w)

b = cfirpm(...,'sym')

b = cfirpm(...,'skip_stage2')

b = cfirpm(..., 'debug')

b = cfirpm(...,{lgrid})

[b,delta] = cfirpm(...)

[b,delta,opt] = cfirpm(...)

`cfirpm` 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 = cfirpm(n,f,@fresp)` returns
a length

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

`@lowpass`,`@highpass`,`@allpass`,`@bandpass`,`@bandstop`These functions share a common syntax, exemplified below by the string

`'lowpass'`.`b = cfirpm(n,f,@lowpass,...)`and`b = cfirpm(n,f,{@lowpass,d},...)`design a linear-phase (`n/2+d`delay) filter.`@multiband`designs a linear-phase frequency response filter with arbitrary band amplitudes.`b = cfirpm(n,f,{@multiband,a},...)`and`b = cfirpm(n,f,{@multiband,a,d},...)`specify vector`a`containing the desired amplitudes at the band edges in`f`. The desired amplitude at frequencies between pairs of points`f(k)`and`f(k+1)`for`k`odd is the line segment connecting the points`(f(k),a(k))`and`(f(k+1),a(k+1))`.`@differentiator`designs a linear-phase differentiator. For these designs, zero-frequency must be in a transition band, and band weighting is set to be inversely proportional to frequency.`b = cfirpm(n,f,{@differentiator,fs},...)`and`b = cfirpm(n,f,{@differentiator,fs,d},...)`specify the sample rate`fs`used to determine the slope of the differentiator response. If omitted,`fs`defaults to 1.`@hilbfilt`designs a linear-phase Hilbert transform filter response. For Hilbert designs, zero-frequency must be in a transition band.`b = cfirpm(n,f,@hilbfilt,...)`and`b = cfirpm(N,F,{@hilbfilt,d},...)`design a linear-phase (`n/2+d`delay) Hilbert transform filter.`@invsinc`designs a linear-phase inverse-sinc filter response.`b = cfirpm(n,f,{@invsinc,a},...)`and`b = cfirpm(n,f,{@invsinc,a,d},...)`specify gain`a`for the sinc-function, computed as sinc(`a`*g), where g contains the optimization grid frequencies normalized to the range [-1,1]. By default,`a`=1. The group-delay offset is`d,`such that the filter response will have a group delay of N/2 +`d`in units of the sample interval, where N is the filter order. Negative values create less delay and positive values create more delay. By default,`d`=0.

`b = cfirpm(n,f,@fresp,w)` uses
the real, non-negative weights in vector

` b = cfirpm(n,f,a)`
is a synonym for

` b = cfirpm(n,f,a,w)` applies
an optional set of positive weights, one per band, for use during
optimization. If

` b = cfirpm(...,'sym') `
imposes a symmetry constraint on the impulse response of the design,
where

`'none'`indicates no symmetry constraint. This is the default if any negative band edge frequencies are passed, or ifdoes not supply a default.`fresp``'even'`indicates a real and even impulse response. This is the default for highpass, lowpass, allpass, bandpass, bandstop, invsinc, and multiband designs.`'odd'`indicates a real and odd impulse response. This is the default for Hilbert and differentiator designs.`'real'`indicates conjugate symmetry for the frequency response

If any * 'sym'* option other than

` b = cfirpm(...,'skip_stage2')` disables
the second-stage optimization algorithm, which executes only when

` b = cfirpm(..., 'debug')` enables
the display of intermediate results during the filter design, where

` b = cfirpm(...,{lgrid})` uses
the integer

Any combination of the * 'sym'*,

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

` [b,delta,opt] = cfirpm(...) ` returns a structure

Field | Description |
---|---|

| Frequency grid vector used for the filter design optimization |

| Desired frequency response for each point in |

| Weighting for each point in |

| Actual frequency response for each point in |

| Error at each point in |

| Vector of indices into |

| 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

[dh,dw] =(n,f,gf,w,p1,p2,...)fresp

where:

`n`is the filter order.`f`is the vector of frequency band edges that appear monotonically between -1 and 1, where 1 corresponds to the Nyquist frequency.`gf`is a vector of grid points that have been linearly interpolated over each specified frequency band by`cfirpm`.`gf`determines the frequency grid at which the response function must be evaluated. This is the same data returned by`cfirpm`in the`fgrid`field of the`opt`structure.`w`is a vector of real, positive weights, one per band, used during optimization.`w`is optional in the call to`cfirpm`; if not specified, it is set to unity weighting before being passed to.`fresp``dh`and`dw`are the desired complex frequency response and band weight vectors, respectively, evaluated at each frequency in grid`gf`.`p1`,`p2`,`...`, are optional parameters that may be passed to.`fresp`

Additionally, a preliminary call is made to * fresp* to
determine the default symmetry property

sym =('defaults',{n,f,[],w,p1,p2,...})fresp

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.

[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.

`fir1` | `fir2` | `firls` | `firpm` | `function_handle`

Was this topic helpful?