# FIR Filter 'design' with the Fourier Series and the Dolph Chebyshev Window.

Cuthbert Nyack
The window function of the Dolph - Chebychev window is a discrete function defined as shown below.
Inverse DFT of (-1)m cos[N acos[a cos(p m/N))) for |a| <= 1
Inverse DFT of (-1)m cosh[N acosh[a cos(p m/N))) for |a| > 1
a = cosh(acosh(10g)/N)
g is a control parameter which varies the stop band attenuation of the window. m goes from 0 to N - 1.
The IDFT is modified according to a suggestion by R. G. Lyons in his blog on dsprelated.com.

Scrollbar 0 sets the type of filter, values from 0 to 3 allows LP, HP, BP and BS filters to be 'designed'. Values from 4 to 7 allows experimenting with adding a slope at the cut off frequency. Although this does not produce significantly better filters, it introduces some of the issues involved in using transition samples with the frequency sampling approximation. When used the slope is set by scrollbar 10.

For all filters, the filter length is set by scrollbar 31, the Chebyshev parameter g is set by scrollbars 1(coarse adjustment) and 2(fine adjustment). The frequencies of the band edges are shown on the applet. eg for LP and HP the cut off frequency is set by scrollbar 4(coarse adjustment) and 5(fine adjustment) etc.

There are 4 frequency reference lines White(set by scrollbar 26), Orange(set by scrollbar 27), Blue(set by scrollbar 28) and Pink(set by scrollbar 29). Gn(WL) etc show the gain at the frequency of the white line etc.
There are 2 dB reference lines Pink Magenta adjusted by scrollbar 24 and blue magenta adjusted by scrollbar 25.

The final result is the impulse response which is shown as I(S30)(n) and all elements of the impulse response can be seen by varying scrollbar 30.

To derive a filter first set the frequency reference lines to the band edges and the dB reference line to the desired stop band attenuation. N, g and wc are then adjusted iteratively until the specifications are met.

A Low Pass filter is shown below.
The attenuation is < 0.1dB for w < 0.13ws and > 125dB for w > 0.20ws.
Stop band attenuation/g ~ 22.

Interpretation of the first line of white text:-
The white/orange/blue/pink frequency reference lines are moved by scrollbars 26/27/28/29 and are located at 0.130/0.149/0.189/0.200 ws respectively.
The pink magenta/blue magenta dB reference lines are moved by scrollbars 24/25 and are located at -128/-125dB.

Interpretation of the second line of white text:-
The gains of the green curve at the white/orange/blue/pink lines are -0.1/-2.951/-63.31/-128.9dB.
The impulse response shown in cyan can be obtained numerically by changing scrollbar 30. I(2) = 2.40120168E-6.

Interpretation of the third line of white text:-
Fn is set by scrollbar 0 and is 0 which illustrates a Low Pass filter.
The length of the filter is set by scrollbar 31 and is 99.
The Dolph-Chebychev parameter g is set by scrollbars 1(coarse adjustment) and 2(fine adjustnment) and is 5.610000.
Cut off frequency is set by scrollbars 4(coarse adjustment) and 5(fine adjustment) and is 0.155604ws.

A High Pass filter is shown below.
The attenuation is < 0.1dB for w > 0.34ws and > 125dB for w < 0.27ws.

A Band Pass filter is shown below.
The attenuation is < 0.1dB for w > 0.16ws and w < 0.28ws and > 125dB for w < 0.086ws and w > 0.353ws .

A Band Stop filter is shown below.
The attenuation is < 0.1dB for w < 0.1ws and w > 0.3ws and > 125dB for w > 0.17ws and w < 0.229ws .

A Low Pass filter with slope is shown below.
The attenuation is < 0.1dB for w < 0.12ws and > 137dB for w > 0.198ws.

A High Pass filter with slope is shown below.
The attenuation is < 0.1dB for w > 0.33ws and > 140dB for w < 0.25ws.

A Band Pass filter with slope is shown below.
The attenuation is < 0.1dB for w > 0.15ws and w < 0.25ws and > 140dB for w < 0.069ws and w > 0.332ws .

A Band Stop filter with slope is shown below.
The attenuation is < 0.1dB for w < 0.08ws and w > 0.32ws and > 140dB for w > 0.149ws and w < 0.25ws .