# Why do we need to have unity gain at DC for a lowpass filter?

I have seen many times, including in a post on this forum, that it is recommended to have unity gain at DC for a lowpass filter. I would like to now the mathematical explanation.

• Could you provide references to where you have seen this? You may be misunderstanding something. – Jason R Jun 3 '13 at 13:55
• Actually, I am using a windowed-sinc filter from "The Scientist and Engineer's Guide to DSP" book, and after filtering the signal using convolution, they were doing a normalization, in order to get unity gain at DC. I also noticed that, I don't have an unity gain for the low frequencies, but some values less than 0.07(I've took the frequency response of the filter). – Victor Jun 7 '13 at 13:14
• I have also tried to create a connection with a similar post: dsp.stackexchange.com/questions/4693/fir-filter-gain. If I put zero in the formula for the frequency, I get one for the exponential and the average of the samples as result. – Victor Jun 7 '13 at 13:19
• Practically, for a buffer of samples you calculate the average and this will be the normalizing coefficient. Here is the detailed problem that I talking about: dspguide.com/ch16/2.htm – Victor Jun 7 '13 at 13:25
• If you want to adjust your FIR filter to have unity gain at DC, then you should adjust it so that the sum of the coefficients is 1, not the average. – Jason R Jun 7 '13 at 13:28

There is no mathematical explanation and it's typically just a convenience for most applications. If you scale so that it's unity at 0 Hz, unity is also the maximum gain at any other frequency so you are less likely to clip or overdrive something in the signal chain (it's still possible though).

It's often based on the assumption or requirement that "frequencies below the cutoff should be unaffected" by a low pass filter. The closest way to get this is to have unity gain at DC.

• You can find here a formula: dsp.stackexchange.com/questions/4693/fir-filter-gain. Practically, I wanted to understand it. – Victor Jun 7 '13 at 13:28
• "unity is also the maximum gain at any other frequency" for a first order filter, or a second order filter with Q less than 0.707, ... – endolith Jun 7 '13 at 21:17

Maintain Dynamic Range While Avoiding Overflow

In fixed-point processing if your gain is less than 1 than you are losing your dynamic range. If you do this enough you can go from a nice strong signal at the beginning of your processing to something that is lost in the noise.

On the other hand, if your gain is greater than 1 then you can go from a signal that does not have numerical overflows to one that does. Overflows are very bad. Thus, a gain that is as near as possible to 1 is ideal.

Consistent Scale

Maintaining a consistent magnitude scale throughout your processing allows you to look at the samples at any stage of your processing and instantly know if the samples are "large" (i.e. signal present) or "small" (i.e. probably just noise). If your scaling is not consistent then you can only do that if you know the scale at the point you are looking at.

This reason applies to both fixed-point and floating-point processing.

amplification and filtering are two separate concepts. a filter only change its magnitude response for the intended frequency range and introducing gains is the job of amplifiers

• Actually, amplification is sometimes done in filters for efficiency's sake. – Jim Clay Jun 6 '13 at 17:07

Low-pass means that low frequencies are not affected while high spectrum is supressed. This is what "pass" stands for. If you change its amplitude, the pass will be not exact. Right? The issue of clipping is also important, as others pointed out. But, I do not believe that it is a primary. Because, your filter may half the low-frequency signal and clipping is not and issue here. Nevertheless, normalization is performed always, as you say. So, there is another reason.

• For any causal low pass filter, the pass is never perfect, since there is always some phase distortion. Clipping is complicated, you can actually clip even if the filter has less than unity gain at all frequencies. – Hilmar Jun 6 '13 at 11:49

Consider the filter to be $h[n]$. Now give a DC input, i.e $x[n]=c$ (a constant) $\forall n$. Now the output of the filter using convolution will be,

$y[n]=x[n]*h[n]=c\sum_{k=0}^{N-1} h[k]$.

Now, the DC content of $h[n]$ is equal to frequency content or strength at the zeroth bin of the DFT, i.e $H(0)=\sum_{k=0}^{N-1} h[k]=1$ will enable a gain of 1 and for DC input such as $x[n]$ above we will get $x[n]$ at the output again ! hence no change in DC content.

If your boss, supervisor, customer or whatever had a look at (or measured) your lowpass frequency response and it provides gain in the passband they would definitely lift their eyebrows and start asking questions. There can be 'internal/practical' reasons as to why your filter must have an input gain (that can be merged into the actual filter coefficients) but it is preferable to restore the gain later on. It is then possible to argue that your filter has non-zero gain at DC but externally it does not appear so.