Filter Design Toolbox    
firceqrip

Design constrained, equiripple, finite impulse response (FIR) filters

Syntax

Description

h = firceqrip(n,wo,del) design an order n filter (filter length equal n+1) lowpass FIR filter with linear phase.

firceqrip produces the same equiripple lowpass filters that remez produces using the Parks-McClellan algorithm. The difference is how you specify the filter characteristics for the function.

Input argument wo specifies the cutoff frequency. The two-element vector del specifies the peak or maximum error allowed in the passband and stopbands. Enter [d1 d2] for del where d1 sets the passband error and d2 sets the stopband error. Since firceqrip works in the normalized frequency domain, you must set wo to be between 0 and 1 (0 < wo < 1).

h = firceqrip(...,'slope',r) uses the input keyword 'slope' and input argument r to design a filter with a stopband that does not demonstrate equiripple characteristics. r determines the slope of the stopband in dB when r > 0. Try setting r to 10 to see the effect on the filter frequency response. In the Examples section, Example 3 designs a filter with r equal to 20.

h = firceqrip(...,'passedge') designs a filter where wo specifies the frequency at which the passband starts to roll off.

h = firceqrip(...,'stopedge') designs a filter where wo specifies the frequency at which the stopband begins.

h = firceqrip(...,'high') designs a high pass FIR filter instead of a lowpass filter.

h = firceqrip(...,'min') designs an FIR filter with minimum phase.

h = firceqrip(...,'invsinc',c)) designs a lowpass filter whose passband has the shape of the inverse sinc function. For this syntax, keyword invsinc applies the inverse sinc function as defined by whether c is a scalar or a two-element vector:

In both cases, c must meet the condition c < 1/wo.

When you use a cascaded-integrated comb (CIC) filter in series with this FIR filter, argument p lets you compensate for the droop in the passband of the CIC filter. Setting p equal to the number of stages in your CIC generally produces an FIR filter whose passband neatly compensates for the CIC passband shape.

To let you specify precisely the FIR filter to design, use any or all of the optional input arguments together. Any ordering of the optional arguments works--order is not important in the function call. Refer to Examples 3 and 4 to see multiple optional input arguments being used.

Examples

To introduce a few of the variations on FIR filters that you design with firceqrip, these five examples cover both the default syntax h = firceqrip(n,wo,del) and some of the optional input arguments. For each example, the input arguments n, wo, and del remain the same.

Example 1--Design an order = 30 FIR filter without using optional input arguments or keywords.

Both the phase and magnitude response for the resulting lowpass filter appear in the plot shown here.

Example 2--Design an order = 30 FIR filter with the stopedge keyword to define the response at the edge of the filter stopband.

Example 3--Design an order = 30 FIR filter with the slope keyword and r = 20.

Example 4--Design an order = 30 FIR filter defining the stopband and specifying that the resulting filter is minimum phase with the min keyword.

Comparing this filter to the filter in Example 1, notice that the cutoff frequency wo = 0.4 now applies to the edge of the stopband rather than the point at which the frequency response magnitude is 0.5.

Viewing the zero-pole plot shown here reveals this is a minimum phase FIR filter--the zeros lie on or inside the unit circle, z = 1.

Example 5--Design an order = 30 FIR filter with the invsinc keyword to shape the filter passband with an inverse sinc function.

With the inverse sinc function being applied defined as 1/sinc(2*w)1.5, the figure shows the reshaping of the passband that results from using the invsinc keyword option, and entering c as the two-element vector [2 1.5].

See Also

firhalfband, firnyquist, gremez, ifir, iirgrpdelay, iirlpnorm, iirlpnormc

fircls, firls, remez in your Signal Processing Toolbox documentation


  filter firhalfband 

Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS