Electronic – MATLAB – FFT aliases occur sooner than expected

fftfrequencysignal processing

I'm using Matlab to analyze the frequency spectrum of a sample wav file. In the frequency plot, I'm seeing aliases occur however they appear sooner than I would expect.

Here is the frequency plot:

enter image description here

Just using some quick calculations, the middle point of reflection seems to be centered around 3200 Hz. This would imply to me that the sampling rate of this wav file must have been around 6400 Hz, however when I load the wav file into audacity, I am told that the sample rate was 11,025 Hz.

enter image description here

I am inclined to believe that this is correct and that the sample rate is 11kHz because when I check the properties of the .wav file, it tells me the bit-rate is 176k, which would correlate to 16-bit samples at a rate of 11k.

So what could explain this? Is it likely that the meta-information in the .wav file is incorrect? Or could there be another explanation?

Best Answer

If you do a FFT in MATLAB, you get one complex valued output (bin) for every input sample. If you then take the magnitude of this complex vector, assuming your original input was real valued, you will see that half the magnitudes will be mirrored. However, the number of bins has nothing to do with the sample rate of the original waveform, only the number of samples in the input. Note that this is simply a function of how the DFT is defined. It looks like your original waveform was about 6400 samples, so that is probably what you are seeing in the first graph (the 6400 frequency bins due to computing a 6400 sample FFT).

If you want to view the FFT in units of frequency (and not bin #) you need to rescale the horizontal axis by the sampling frequency. That is, the frequency of bin n is: \$f_n=\frac{nf_s}{L}\$ where \$f_s\$ is the sampling frequency and \$L\$ is the length of the waveform.