Low Pass Equiripple FIR Filters.

Cuthbert Nyack
In the applet below, the approach developed by Remez and Parks-McClellan is used and is described in Digital Filter Designer's Handbook by C. Rorabaugh published by McGraw Hill.

Only odd length filters can be derived with the applets here.

In this method an iterative approach is used to find the location of the frequencies at which the extrema occur. From this, the frequency response is generated and the impulse response found by taking the inverse DFT of the sampled frequency response. The final result depends on the assumptions made about the shape of the transition band response.
In the applet below, one sets the pass band edge Fp(58)(this notation means that Fp is set by scrollbar 58), the stop band edge Fs(59), the ratio of pass band to stop band ripple RR(62) and the attenuation in the stop band in dB dB(56).
The total number of extrema and the number in the passband is then guessed (applet on previous page can be used as a guide) and the extrema frequencies (magenta) adjusted by the scrollbars until they coincide with the error extrema (yellow). The error is the difference between the filter response and the ideal filter response. The maths used here to calculate the error from the extrema frequencies was taken from Digital Filter Designer's Handbook by C. Rorabaugh published by McGraw Hill. If the stop band attenuation is satisfactory then the extrema frequencies have been found (pink). If not then one has to restart with a different number of extrema. 'eG(45)' is the error gain and 'Gd(51)' is the grid density.

Although this interactive approach can be slow compared to using software to locate the frequency extrema, it can better illustrate how equirippability arises.

One half of the symmetric Impulse response is shown in orange and for verification, the frequency response derived from the impulse response is shown as blue magenta. This curve is shifted downwards to avoid to much overlap with the green one obtained from the frequency extrema. The frequency response in the transition regionis not calculated when locating the extrema and this region is plotted as a straight line. If calculated in the transition region, the green curve is the same as the blue magenta one.

This approach is optimal in the sense that it produces a filter with the minimum number of taps that can achieve the desired characteristics.

In the applet, the error gain (scrollbar(57)) should first be set at a low value where the error is visible but not too large. The frequency extrema, starting with the ones near the band edges, should then be moved to produce approximate equiripples.
The numbers next to the frequency extrema indicate the scrollbar which moves that extrema. As the applet opens the scroillbars 7 and 8 control the extrema at the edges. The scrollbars controlling the extrema at the band edges and at half the sampling frequency are shown in red. Adjustment should first be made by moving down scrollbar 6 by clicking on the down arrow. This moves the extrema next to the edge of the pass band to the right. Scrollbar 9 should then then be reduced by clicking on the up arrow to move the extrema next to the edge of the stop band to the left. Adjustment should then be made to the other extrema to get approximate equiripples across both bands.
In this first step the frequency extrema may appear to be at the zeros of the error rather than the extrema. However this situation should correct itself after approximate equiripple error is obtained across both the pass and stop bands. The error gain can then be increased and the proceedure repeated until a satisfactory result is obtained.
Sudden large movements in one of the frequency extrema can lead to a situation that can be difficult to retrieve. When that happens, it may be better to restart the applet by reloading the page.
It is possible to get the frequency and error extrema aligned without equiripple behaviour, usually this occurs when a larger ripple occurs at 0 or at half the sampling frequency. When that happens, the number of extrema in the offending band should be increased by 1.



One possibility is shown by the gif image below.
In this case, the stop band attenuation is measured by adjusting scrollbar 56 until the horizontal dark red line sits just above the maxima in the stop band. The attenuation is then shown by dB(56) = 72.00dB.
The pass band is from 0 to Fp(58)ws = 0.2ws.
The stop band is from Fs(59)ws = 0.25ws to 0.5ws.
The total number of extrema Te(60) is 42, the number of extrema in the pass band Pe(61) is 25 and the number of extrema in the stop band is Te(60) - Pe(61) = 17.
The ratio of the pass band ripple to the stop band ripple RR(62) is 25.0.
The number of grid points per extrema Gd(63) = 16.0.
The number of taps required to realize the filter is Ntap = 81.
Notice the alignmemt of the frequency extrema (magenta) with the extrema of the error (yellow). Once this alignment is achieved, then the resulting filter has equiripple characteristics and the impulse response shown in orange can be used to realize the filter.

When the error gain is adjusted by scrollbar 57 to make the ripple amplitude equal to 1div(50 pixels) then the error gain is shown by eG(57) ~ 213796 and the stop band ripple is 50/eG(57) ~ 50/213796 ~ 0.000233 and the pass band ripple is 0.000233 x RR(62) = 0.000233 x 25 ~ 0.00584.

The example shows extrema at 0, 0.5ws and at the pass band and stop band edges. This applet always shows extrema at the pass band and stop band edges but not always at 0 or 0.5ws.
The following image shows the filter obtained with the applet using the starting parameters Fp = 0.2, Fs = 0.28, Te = 19, Pe = 8.
In the case the number of extrema in the stop band is reduced from 11 to 10. Equiripple behaviour is still observed with a smaller attenuation in the stop band.
Below the number of extrema in the pass band is reduced from 8 to 7. There are more extrema in the error 8 than there are frequency extrema 7 and it is impossible to get alignment in the pass band. This behaviour makes it easier to determine the number of required extrema in a band.
Below the number of extrema in the stop band is reduced from 11 to 9. There are more extrema in the error than there are frequency extrema and it is impossible to get alignment in the stop band.
Case below shows as far as is possible with this applet, a stop band attenuation of 72dB with a transition bandwidth of 0.03. Slight variations in the error amplitude suggest that furthur refinement of some of the extrema is still possible.

The applet below could be used to get an estimate of the length of the filter required for a particular application eg for parameters(25.0, 70.0, 0.06), applet suggest a length of ~51 or ~49.

The 2 images show for Ntap = 49 the stop band attenuation is 67dB and for Ntap = 53, the stop band attenuation is 71dB.
N = 51 does not give an acceptable division of extrema in the 2 bands for the given pass and stop band bandwidths.


The applets here on equiripple filters appear quite consuming at first attempt. However after a couple of successes, they become quite easy to use.
Return to main page
Return to page index
COPYRIGHT © 2008 Cuthbert Nyack.