Main Content

firhalfband

(To be removed) Halfband FIR filter design

The firhalfband function will be removed in a future release. Use the designHalfbandFIR function instead. For more information on how to update your existing code, see Version History.

Description

b = firhalfband(n,fp) designs a lowpass FIR halfband filter of order n with an equiripple characteristic. n must be an even integer. fp determines the passband edge frequency such that 0 < fp < 1/2, where 1/2 corresponds to π/2 rad/sample.

b = firhalfband(n,win) designs a lowpass nth-order filter using the truncated windowed-impulse response method instead of the equiripple method. win should be an n+1 length vector. The function truncates the ideal response to length n+1, then multiplies it point-by-point with the window specified in win.

b = firhalfband(n,dev,'dev') designs an nth-order lowpass halfband filter with an equiripple characteristic. dev sets the value for the maximum passband and stopband ripple.

b = firhalfband('minorder',fp,dev) designs a lowpass minimum-order filter with passband edge fp. The peak ripple is constrained by the scalar dev. This design uses the equiripple method.

example

b = firhalfband('minorder',fp,dev,'kaiser') designs a lowpass minimum-order filter with passband edge fp. The peak ripple is constrained by the scalar dev. This design uses the Kaiser window method.

b = firhalfband(___,'high') returns a highpass halfband FIR filter.

b = firhalfband(___,'minphase') designs a minimum-phase FIR filter such that the filter is a spectral factor of a halfband filter. Recall that h = conv(b,fliplr(b)) is a halfband filter. This can be useful for designing perfect reconstruction two-channel FIR filter banks. The 'minphase' option is not available for window-based halfband filter designs such as b = firhalfband(n,win) and b = firhalfband('minorder',fp,dev,'kaiser').

In the minimum phase case, the filter order n must be odd.

Examples

collapse all

Design a minimum order halfband filter with maximum ripple set to 0.0001.

b = firhalfband('minorder',.45,0.0001);
impz(b)

Input Arguments

collapse all

FIR halfband filter order, specified as an integer

If you specify the firhalfband function to design a minimum phase filter using the 'minphase' argument, the filter order must be odd. In all other cases, the filter order must be even.

Data Types: single | double

Passband edge frequency, specified as a scalar in the range (0,½), where ½ corresponds to π/2 rad/sample.

Data Types: single | double

Window to apply to the filter, specified as an n+1 length vector. The function truncates the ideal response to length n+1, then multiplies it point-by-point with the window specified in win.

Data Types: single | double
Complex Number Support: Yes

Maximum passband and stopband ripple in the halfband filter, specified as a scalar.

Data Types: single | double

Output Arguments

collapse all

FIR halfband filter coefficients, returned as a vector.

Data Types: single | double
Complex Number Support: Yes

More About

collapse all

Algorithms

The firhalfband function uses the equiripple or the Kaiser window method to design the FIR halfband filter. You can also specify a custom window using the win argument.

Halfband Equiripple Design

In the equiripple method, the algorithm uses a minimax (minimize the maximum error) FIR design to design a fullband linear phase filter with the desired specifications. The algorithm upsamples a fullband filter to replace the even-indexed samples of the filter with zeros and creates a halfband filter. It then sets the filter tap corresponding to the group delay of the filter in samples to 1/2. This yields a causal linear-phase FIR filter approximation to the ideal halfband filter defined in Halfband Filters. See [2] for a description of this filter design method using the Remez exchange algorithm. As you can design a filter using this approximation method with a constant ripple both in the passband and stopband, the filter is also known as the equiripple filter.

Window-based Design

In the window-based design method, the algorithm first truncates the ideal halfband filter defined in Halfband Filters, then it applies the user-specified window. This yields a causal linear-phase FIR filter approximation to the ideal halfband filter. If you provide the 'kaiser' argument, the function calculates the window as mentioned in Kaiser Window.

For more information on designing FIR halfband filters, see FIR Halfband Filter Design.

References

[1] Saramaki, T, “Finite Impulse Response Filter Design,” Handbook for Digital Signal Processing. S.K. Mitra and J.F. Kaiser Eds. Wiley-Interscience, N.Y., 1993, Chapter 4.

[2] Harris, F.J. Multirate Signal Processing for Communication Systems, Prentice Hall, 2004, pp. 208–209.

Extended Capabilities

expand all

Version History

Introduced in R2011a

expand all

See Also

Functions