Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# firhalfband

Halfband FIR filter

## Syntax

b = firhalfband(n,fp)
b = firhalfband(n,win)
b = firhalfband(n,dev,'dev')
b = firhalfband('minorder',fp,dev)
b = firhalfband('minorder',fp,dev,'kaiser')
b = firhalfband(...,'high')
b = firhalfband(...,'minphase')

## Description

b = firhalfband(n,fp) designs a lowpass halfband FIR filter of order n with an equiripple characteristic. n must be an even integer. fp determines the passband edge frequency, and it must satisfy 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 is an n+1 length vector. The ideal impulse response is truncated to length n + 1, and then multiplied 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. Input argument dev sets the value for the maximum passband and stopband ripple allowed.

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.

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 for firhalfband is not available for the window-based halfband filter designs — b = firhalfband(n,win) and b = firhalfband('minorder ',fp,dev,'kaiser').

In the minimum phase cases, the filter order must be odd.

## Examples

This example designs a minimum order halfband filter with specified maximum ripple:

b = firhalfband('minorder',.45,0.0001);
h = dfilt.dfsymfir(b);
impz(b) % Impulse response is zero for every other sample

The next example designs a halfband filter with specified maximum ripple of 0.0001 dB in the pass and stop bands.

b = firhalfband(98,0.0001,'dev');
h = mfilt.firdecim(2,b); % Create a polyphase decimator
freqz(h); % 80 dB attenuation in the stopband

## References

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.