# scaling magnitude of the dft

I have seen a lot of question like this, but still I have doubts about the answer. When using the fft in matlab the solution need to be divided by the length of the signal (N). I have seen many answers that say that there are at least 3 type of normalisation: 1. 1/N (I have seen to use this a lot of time) 2. 1 3. 1/sqrt(N) What is difficult to understand to me is when I should use each one of this 3 normalisation. It is difficult to me to understand why this 3 different normalisation can be exact together. If I want to obtain the right amplitude which one should be chosen and Why? Another thing, I was thinking the fact that if we look at the fourier coefficient, there is a normaliation 1/N. Is this the explanation of using this normalisation?

$$1/N$$ is the correct scaling to have the resulting DFT output represent the average for the input signal that is rotating (frequency) at that particular bin in the DFT.

This is very clear when considering bin 0:

$$F[k=0] = \frac{1}{N}\sum_{n=0}^{N-1}x[n]e^{-j0} = \frac{1}{N}\sum_{n=0}^{N-1}x[n]$$

Where we see it is simply the average. For signal at any other frequency, the DFT essentially de-rotates that signal to 0 and then takes the average. It may help to realize that the form $$e^{j\omega t}$$ represents a complex spinning phasor with magnitude 1 and frequency of rotation $$\omega$$, spinning counter-clockwise in time. Similarly the form $$e^{-j\omega t}$$ is a complex phasor spinning clockwise in time.

So if you considered another example signal that was completely at bin 1 once the DFT is taken, this would the spinning phasor $$e^{j\omega_0 n}$$ in time where $$\omega_o$$ rotates ones as we count from $$0$$ to $$N-1$$ and n is the discrete sample index in time. So specifically $$x[n]=e^{j2\pi n/N}$$. Look what we do under the hood in the DFT equation with $$x[n]=e^{j2\omega_o n}$$:

$$F[k=1] = \frac{1}{N}\sum_{n=0}^{N-1}x[n]e^{-j\omega_o n}$$

$$e^{j2\omega_o n}e^{-j\omega_o n} = 1$$ so we again arrive at the moving average for the signal that was at that particular frequency.

To answer @relayman357 challenge with this the correct scaling of $$1/N$$ does makes sense as given by Euler's identity, we see that the average value for each of the two complex tones in a real sinusoid is 1/2!

$$cos(\omega t) = \frac{e^{j\omega t} + e^{-j\omega t}}{2}$$

So if you want the result to accurately represent an average quantity, you divide by N. However this scaling is arbitrary and $$1/\sqrt{N}$$ is also commonly used as it makes the DFT and IDFT completely symmetric since that same scaling can then be used in either direction.

Luca - this is a good question. If you use the approach here the magnitudes of the resulting harmonics are wrong. I can't figure that out myself. For example, if you take a sine wave with amplitude A and run it through, the resulting Xk will be wrong by N/2. So, you have to scale them by 2/N to get the original amplitude A.

Power engineers like quantities in [RMS] so you would add a square root of 2 in the denominator (2/N/root2) to get RMS.

I'd love the math folks to help us with this - maybe they don't care about the actual amplitude of each harmonic? Maybe all they care about is the angle or the relative magnitudes...

• The reason it appears “wrong” is that the Fourier Transform is telling you the magnitude of each exponential not each sinusoid: From Euler’s identity you get the relationship between the two: cos(wt) = 1/2 e^(j wt) + 1/2 e^(-j wt) Oct 27, 2021 at 23:49
• Well, there we have it. Thank you @DanBoschen - much appreciated. Oct 28, 2021 at 14:27
• Glad you see it with that super short explanation. When you do a complex conjugate product of two functions and then integrate the result - that is a “correlation” and it will maximize in signal to noise ratio (for uniform white noise) when the functions are equal - as the phases in each product will cancel and you accumulate a big sum all aligned. This is what is happening in the FT: we correlate to each e^(j 2pi f t) term and the result shows us the amount of each of those terms in the original waveform —- thus a sinusoid ends up with two peaks since it has two such terms. Oct 28, 2021 at 14:56