I am trying to do an FFT on some data I have captured. I am working in the 10MHz-100MHz range, so my 8192 sample captures will not be big enough to convey anything meaningful when doing an FFT on them. So I am taking many non-overlapping captures of a sine wave and want to average them together.
What I am currently doing (in Scilab) in a for-loop for every file is:
temp1 = read_csv(filename,"\t");
temp1_fft = fft(temp1);
temp1_fft = temp1_fft .* conj(temp1_fft);
temp1_fft = log10(temp1_fft);
fft_code = fft_code + temp1_fft;
And then when I am done with all the files I:
fft_code = fft_code./numFiles;
But I am not so sure that I am handling this correctly. Is there a better way for non-overlapping samples?
I think you are close, but you should average the magnitude of the spectrums (
temp1_fft) before taking thelog10. Otherwise you essentially end up multiplying them instead of averaging. So instead, just move thelog10to outside the for loop like so (I don’t know scilab syntax):You definitely want to use the magnitude (you are already doing this when you multiply by the
conj), as the phase information will depend on when your sampling began relative to the signal. If you need the phase information, you have to make sure your acquisitions are in sync with the signal somehow.What this does is called “Power Spectrum Averaging”: