A low pass filter is a frequency filter that allows (passes) frequency below a certain cutoff frequency and disallows (stops) the frequencies above that cutoff frequency.
An ideal low pass filter
An ideal low pass filter is one that passes all low frequencies – below the cutoff frequency – with unchanged amplitude and one that completely stops all high frequencies. The amplitudes of the low frequencies in the output signal will be 100% of the amplitude of the same frequencies in the input signal. The amplitudes of the high frequencies in the output signal will be zero, independently of what the amplitudes of those frequencies may be in the input signal.
The following is a graph of the magnitude response of an ideal low pass filter with some cutoff frequency.
All frequencies below the cutoff frequency remain at their original amplitude. All frequencies above the cutoff frequency are completely removed.
An example finite impulse response (FIR) digital low pass filter
A typical digital finite impulse response filter a(k) computes the output signal y(n) from the input signal x(n) with the following weighted average formula.
A good low pass filter a(k) is
where f_{s} is the sampling frequency, N is the length of the filter (the number of items in the weighted sum), and f_{c} is the cutoff frequency.
If, for example, f_{s} = 2000 Hz, f_{c} = 40 Hz, and N = 201, the magnitude response of the filter will be as in the graph below.
The magnitude response of this filter is not ideal. This said, the filter preserves the amplitudes of frequencies below 40 Hz almost unchanged and attenuates frequencies above 40 Hz. It is thus a low pass filter with a cutoff frequency of 40 Hz.
An example infinite impulse response (IIR) digital low pass filter
The following computation of the output signal y(n) from the input signal x(n) is an example of an impulse invariant second order low pass Butterworth filter
with normalized cutoff frequency ω_{c} = 0.6 (actual cutoff frequency equal to ω_{c} * f_{s} / (2π)). This filter has the transfer function
Given a sampling frequency of, for example, f_{s} = 2000 Hz, the cutoff frequency of this filter becomes 0.6 * 2000 / (2π) = 191 Hz, and the corresponding magnitude response becomes as follows.
This filter preserves somewhat the amplitude of frequencies below 191 Hz and decreases the amplitudes of frequencies above 191 Hz. Although this is also not an ideal low pass filter, it is a practical low pass filter with cutoff frequency 191 Hz.
Deriving the FIR low pass filter
The desired magnitude response of an ideal low pass filter could be written as follows.
This is an ideal magnitude response of some low pass filter with normalized cutoff frequency f_{c} / f_{s}. By the Nyquist-Shannon sampling theorem f_{c} / f_{s} < 1/2. Using a magnitude response that is symmetric around zero and includes negative frequencies is beneficial, since it allows the inverse Fourier transform below to produce a filter with real valued and not complex valued coefficients.
Denote F = f_{c} / f_{s}. The inverse Fourier transform of the ideal magnitude repose is
The function sin(t) / t is the function sinc(t) and so FIR filters are occasionally called sinc functions. The sinc function in the equation above has ever increasing oscillations until t = 0, at which point it is a(0) = 2 F, after which it has ever decreasing oscillations. To create a discrete time filter, we will sample this continuous time function between -1 and 1 at the sampling frequency.
We then pick a discrete filter of length N from the middle N points of the sampled a(k) and shift it to the right by (N – 1) / 2. This would produce the finite impulse response low pass filter above. In the middle of the filter, at k = (N – 1) / 2, we use L'Hopital's rule, which states that if the limits of the numerator and denominator are zero and the limits of the derivatives exist, the limit of the ratio is equal to the ratio of the limits of the derivatives.
An alternative derivation
We use the fact that applying a FIR filters to an input signals is simply a convolution of the filter with the signal. The convolution of a cosine and a sine functions of integer frequencies n_{1} and n_{2} produces zero, if the two integer frequencies are different, and something other than zero, if the n_{1} = n_{2}.
where one of the simple wave functions in the convolution above is restricted to an interval of unit time and is zero outside of that interval. The result is similar for two cosine and two sine functions. In other words, the convolution of a signal with a properly bound simple cosine or a sine wave would return that same wave in the signal, if the wave exists, and will return zero otherwise. This means that we can design a filter by summing up all simple waves that we want the filter to preserve.
Since we are summing integer frequencies, we can use the following identity, known as the Dirichlet kernel.
We compute
We note that the convolution of two simple waves with the same frequency produces the same wave, but with amplitude scaled by f_{s} / 2. Thus, we scale the filter by 2 / f_{s}. We also note that the filter above cannot be computed at k = 0, since the sine in the denominator would produce zero. We use L'Hopital's rule again. We also center the filter so that its peak is in the middle.
Last but not least, this filter is simply too long. Every output sample produced with this filter would require fs computations. We would prefer a shorter filter of N points.
This formula is an approximation of the first formula above. At f_{s} = 2000 Hz, N = 101, and f_{c} = 40 Hz, for example, the magnitude response of the first filter above (blue) and the filter here (red) are almost identical.
The second filter is, in essence, derived using the discrete Fourier transform and is hence less precise.
Deriving the infinite impulse response low pass filter
IIR low pass filters are also typically derived from their desired magnitude response. For an example of how IIR low pass filters are derived, see the topic Butterworth filter.