Tuesday, May 28, 2024

Tutorial: Half Band Filters

Parent Category: 2020 HFE

By Ain Rehman

Half band filters are useful digital filters that have symmetric impulse responses and generally about half their impulse response consists of 0 (zero) thus allowing for fewer multiplications. One of their prime uses is in decimation of multirate digital signals.

For a good basic introduction to FIR filters please read the FIR filter book. The link is: https://www.amazon.com/s?k=finite+impulse+response+digital+filter+design+Ain+Rehman &i=stripbooks&ref=nb_sb_noss.

The following discussion presents more details on the half band filter as well as its usage in the decimation filter.

“In digital signal processing, half-band filters are widely used for their efficiency in multi-rate applications. A half-band filter is a low-pass filter that reduces the maximum bandwidth of sampled data by a factor of 2 (one octave). When multiple octaves of reduction are needed, a cascade of half-band filters is common. And when the goal is downsampling, each half-band filter needs to compute only half as many output samples as input samples.” Wikipedia.

The frequency response of this type of filter is symmetrical about the (1/4)fs point on the frequency axis. Where fs is the sampling frequency. Because of this characteristic every other tap value of this filter is equal to zero. This implies that we do not need to do a multiplication for that tap reducing the need for multiplications! A very cost effective and useful property indeed, since multiplication takes time and silicon area. The fewer the multiplications, the lower the cost.

In addition it has some other interesting properties.

wp + wst = π ( radians/sample)

ws/2    = π ( radians/sample)

ws/4    = π/2 center of symmetry


δp = δs pass and stop band ripples

wp passband edge, wst stopband edge

ws is the sampling frequency.

Note that the frequency axis can be specified in radians/sample, normalized frequency; normalized to the sampling rate or half sampling rate (preferred by MATLAB) etc. An excellent reference to understanding these units is the web article: “The concept of digital frequency,” by Professor Fowler, Department of Electrical Engineering, State University of New York at Binghamton. Also a good explanation is provided in the Signal Processing Group Inc., blog at: http://www.signalpro.biz/wordpress/.

The author was surprised at how little there is in terms of literature about half band filters on the web. What little exists is unclear and difficult to understand. However, here are a few references that may be useful to those seeking an understanding of the circuit as well as those wishing to design these filters.

Ref HB 1.0 MATLAB from Mathworks. Accessing information about half band filters is free on the web from Mathworks but you will have to be either a student or wealthy, to get the tool itself. Also, MATLAB has a script called firhalfband that will design and analyze a half band filter given a good set of specs.

Ref HB 2.0 https://www.cs.tut.fi/~ts/sldsp_part2_identical_subfilters_halfband.pdf. Good reference for intuitive understanding of half band filters.

Ref HB 3.0 A reasonably good reference to synthesis of a windowed sinc filter. The techniques are well explained for windowed sinc filters. http://www.dspguide.com/

Ref HB 4.0 The author’s book on the very fundamentals of FIR filters. Amazon publishers:

https://www.amazon.com/s?k=fir+filter+design+ practical+approaches+ain+rehman&ref=nb_sb_noss

Ref HB 5.0 A javascript program developed by the author and available free of charge on the usage of the windowed sinc method with Hamming and Blackman windows available upon request at spg@signalpro.biz. This CAD tool was developed based on the techniques suggested in Ref 3.0.

Ref HB 6.0 “Discrete time signal processing,” Oppenheim and Schafer. Prentice Hall signal processing series.

At this point we continue on the discussion of the design of half band filters. Please refer to Figure 9.

2007 Tutorial fg09

Figure 9

CAD tools: The essential tool to be used in the design of these filters (or indeed other digital filters) is MATLAB Signal Processing Toolbox. If at all possible the designer should obtain this tool. MATLAB offers free trials of its package and especially low prices for students. MATLAB can be used to design the half band filter using its firhalfband script and also help to analyze a design that may have been designed some other way.

However, if MATLAB is not available then some of the other techniques mentioned in the following may be used. It will just take longer to optimize the filter design but it can still be done.

Example of a MATLAB half band filter design

This script has been copied straight from MATLAB’s example.


Fs  = 96e3;

Fp  = 22e3;

N   = 100;

num = firhalfband(N,Fp/(Fs/2));

fvt = fvtool(num,’Fs’,Fs,’Color’,’white’);

fvt.MagnitudeDisplay = ‘Zero-phase’;

Fs is the sampling rate or frequency. It is very important to appreciate that these filters are very dependent on Fs.As Fs changes the filter performance will change.

Fp is the passband edge.

N is the order of the filter. It is shown to be even.

num is the number impulse response coefficients.

fvt is the filter visualization tool. This allows the user to look at the various characteristics of the filter graphically and otherwise.

It is best if the reader runs this script in MATLAB to see the results. It is also recommended that the reader modifies the script to fit his design and then use the FVT to analyze the design. MATLAB has extensive support so the reader should be able to, very quickly, design the half band filter using this tool.

Windows sinc tool

If for some reason MATLAB is not available then another method for design can be used called the windowed sinc (Ref HB 3.0).

This script has been implemented in Javascript by the author and is available free of charge. Please download the script from the Signal Processing Group Inc. website at: www.signalpro.biz>complementary.

This script and a companion, implements the windowed sinc method for the Hamming window and the Blackman window.

The user has to make some modifications such as the cut off frequency and the order. The order, called M, can be calculated by using the following identity: M=4/BW where BW is the width of the transition region. M should be even.(Ref HB 3.0).

The script provides the impulse response of the filter. Simply run the script and the impulse response coefficients are written on the standard output.

The frequency response can be found by taking the Fourier response, using the coefficients generated by the script. There are a number of freeware packages that can be used to do this. In addition MATLAB can be used to derive the frequency response. Here is an example MATLAB script that does this provided by MATLAB staff.

b=fir2(12,f,a); [ b = coefficients of a filter generated bt the fir2 command. ( MATLAB).]

[h,t]=impz(b); [ h is the magnitude of the impulse response at time t]

[H,F] = freqz(h,1,Nfft); [H and F magnitude of the frequency response at frequency F];

semilogx(F,mag2db(abs(H))); grid on; [ Plot the response]

xlabel(‘Frequency (Hz)’); ylabel(‘Magnitude (dB)’); [ Label the plot].

Note: fir2 provides a filter coefficient vector for a given arbitrary frequency and matching amplitude. The frequency needs to start at 0, and end at 1.Normalized to the sampling rate.

Semi-manual half band filter design described in Ref HB 2.0. Here the impulse response is built manually in three steps. Once the impulse response is built it can be converted to frequency response as required. There is also additional discussion with examples.

About the Author

Ain Rehman is founder and chief engineer at Signal Processing Group. Contact him at spg@signalpro.biz for the javascript of the Windowed Sinc technique.

Current Issue

2024 05 HFE cover

The May 2024 Online Edition is now available for viewing and download!

View Current HFE