Two things that jump on me:
- I'm not sure why you include the DC component (index = 1) in your plot. It doesn’t matter, but, of course, there is no frequency data in this bunker.
- I think dividing by
length(allSamples)
will be more correct than dividing by NFFT
. The reason is that if you want the DC component to be equal to the average value of the input, dividing by length(allSamples)
is the right thing.
However, as Olya said, you cannot say what the “normal” normalization is until you know exactly what you are trying to calculate. I tend to use FFTs to estimate power spectra, so I want units like “DAC / rt-Hz”, which would lead to a different normalization than if you wanted something like “DAC / Hz”.
Ultimately, there is no way to think about what you want to get out of the FFT (including units), and to develop for yourself what the correct normalization should be (based on the definition of the FFT, if necessary).
You should also be aware that MATLAB fft
does not require the use of an array length that has a power of 2 (although this will apparently lead to FFT acceleration). Since zero padding will cause some calls, you need to consider whether this is the right thing to do for your application.
Finally, if the frequency / power spectrum is really what you want, MATLAB provides functions such as periodogram
, pwelch
and others that may be useful.
source share