Main Content

firlpnorm

Least P-norm optimal FIR filter

Syntax

b = firlpnorm(n,f,edges,a)
b = firlpnorm(n,f,edges,a,w)
b = firlpnorm(n,f,edges,a,w,p)
b = firlpnorm(n,f,edges,a,w,p,dens)
b = firlpnorm(n,f,edges,a,w,p,dens,initnum)
b = firlpnorm(...,'minphase')
[b,err] = firlpnorm(...)

德scription

b = firlpnorm(n,f,edges,a)returns a filter of numerator ordernwhich represents the best approximation to the frequency response described byfandain the least-Pth norm sense. P is set to 128 by default, which essentially equivalent to the infinity norm. Vectoredgesspecifies the band-edge frequencies for multiband designs.firlpnormuses an unconstrained quasi-Newton algorithm to design the specified filter.

fandamust have the same number of elements, which can exceed the number of elements inedges. This lets you specify filters with any gain contour within each band. However, the frequencies inedgesmust also be in vectorf. Always usefreqzto check the resulting filter.

Note

firlpnormuses a nonlinear optimization routine that may not converge in some filter design cases. Furthermore the algorithm is not well-suited for certain large-order (order > 100) filter designs.

b = firlpnorm(n,f,edges,a,w)uses the weights inwto weight the error.whas one entry per frequency point (the same length asfanda) which tellsfirlpnormhow much emphasis to put on minimizing the error in the vicinity of each frequency point relative to the other points. For example,

b = firlpnorm(20,[0 .15 .4 .5 1],[0 .4 .5 1],... [1 1.6 1 0 0],[1 1 1 10 10])

designs a lowpass filter with a peak of 1.6 within the passband, and with emphasis placed on minimizing the error in the stopband.

b = firlpnorm(n,f,edges,a,w,p)wherepis a two-element vector [pmin pmax] lets you specify the minimum and maximum values ofpused in the least-pth algorithm. Default is[2 128]which essentially yields the L-infinity, or Chebyshev, norm.pminandpmaxshould be even numbers. The design algorithm starts optimizing the filter withpminand moves toward an optimal filter in thepmaxsense. Whenpis set to 'inspect',firlpnormdoes not optimize the resulting filter. You might use this feature to inspect the initial zero placement.

b = firlpnorm(n,f,edges,a,w,p,dens)specifies the grid densitydensused in the optimization. The number of grid points is [dens*(n+1)]. The default is 20. You can specifydensas a single-element cell array. The grid is equally spaced.

b = firlpnorm(n,f,edges,a,w,p,dens,initnum)lets you determine the initial estimate of the filter numerator coefficients in vectorinitnum. This can prove helpful for difficult optimization problems. The pole-zero editor in Signal Processing Toolbox™ software can be used for generatinginitnum.

b = firlpnorm(...,'minphase')where 'minphase' is the last argument in the argument list generates a minimum-phase FIR filter. By default,firlpnormdesign mixed-phase filters. Specifying input option 'minphase' causesfirlpnormto use a different optimization method to design the minimum-phase filter. As a result of the different optimization used, the minimum-phase filter can yield slightly different results.

[b,err] = firlpnorm(...)returns the least-pth approximation errorerr.

Examples

collapse all

Lowpass filter with a peak of 1.4 in the passband.

b = firlpnorm(22,[0 .15 .4 .5 1],[0 .4 .5 1],[1 1.4 1 0 0],...[1 1 1 2 2]); fvtool(b)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains an object of type line.

The resulting filter is lowpass, with the desired 1.4 peak in the passband (notice the 1.4 specified in vector a).

Highpass minimum-phase filter optimized for the 4-norm.

b = firlpnorm(44,[0 .4 .45 1],[0 .4 .45 1],[0 0 1 1],[5 1 1 1],...[2 4],'minphase'); fvtool(b)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains an object of type line.

This is a minimum-phase, highpass filter.

The zero-pole plot shows the minimum phase nature more clearly.

fvtool(b,'polezero')

Figure Pole-Zero Plot contains an axes object. The axes object with title Pole-Zero Plot contains 5 objects of type line, text.

References

Saramaki, T, Finite Impulse Response Filter Design,Handbook for Digital Signal ProcessingMitra, S.K. and J.F. Kaiser Eds. Wiley-Interscience, N.Y., 1993, Chapter 4.

Extended Capabilities

版本历史

Introduced in R2011a