Halfband FIR filter design
designs a lowpass
b = firhalfband(
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
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.
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
In the minimum phase case, the filter order
n must be odd.
Design Halfband Filter using
Design a minimum order halfband filter with maximum ripple set to 0.0001.
b = firhalfband('minorder',.45,0.0001);
The impulse response is zero for every alternate sample.
n — FIR halfband filter order
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.
fp — Passband edge frequency
scalar in the range (0,½)
Passband edge frequency, specified as a scalar in the range (0,½), where ½ corresponds to π/2 rad/sample.
win — Window to apply to filter
n+1 length vector
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
Complex Number Support: Yes
dev — Maximum passband and stopband ripple
Maximum passband and stopband ripple in the halfband filter, specified as a scalar.
b — FIR halfband filter coefficients
FIR halfband filter coefficients, returned as a vector.
Complex Number Support: Yes
The ideal lowpass halfband filter is given by
The ideal filter is not realizable because the impulse response is noncausal and not absolutely summable. However, the impulse response of the ideal lowpass filter possesses some important properties that are required of a realizable approximation. Specifically, the ideal lowpass halfband filter’s impulse response is:
Equal to 0 for all even-indexed samples.
Equal to 1/2 at n=0. You can see this by using L’Hopital’s rule on the continuous-valued equivalent of the discrete-time impulse response.
The ideal highpass halfband filter is given by
Evaluating the preceding integral gives the following impulse response
The ideal highpass halfband filter’s impulse is:
Equal to 0 for all even-indexed samples
Equal to 1/2 at n=0
firhalfband function uses a causal FIR approximation to the
ideal halfband response, which is based on minimizing the norm of the error (minimax).
The coefficients of a Kaiser window are computed using this equation:
where I0 is the zeroth-order modified Bessel function of the first kind.
To obtain a Kaiser window that represents an FIR filter with stopband attenuation of α dB, use this β.
The filter order n is given by:
where Δω is the transition width.
For more details, see Algorithms.
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
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  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.
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.
 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.
 Harris, F.J. Multirate Signal Processing for Communication Systems, Prentice Hall, 2004, pp. 208–209.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
All inputs must be constant. Expressions or variables are allowed if their values do not change.