FFT in Excel — How to Obtain the Most Realistic Sp

2019-07-29 11:32发布

问题:

I’m trying to obtain the FFT spectrum of these data: gggttt.host.sk/sample.xls using Excel. @Paul R helped me a lot in another question to figure out the meaning of bins but there are still questions which I’d like to understand.

First, Excel, even when the moduli are represented in log scale, does not show them in dB. What do you do to have these magnitudes converted to dB?

Further, there’s a concern about the window function, aliasing etc. Since I’m crunching data from exactly one period, it seems that applying a window function is not necessary. Also, because I need only the fundamental, second and third harmonic and no other peaks in the higher bins, taking care of aliasing also does not seem necessary. Of great concern, however, is the non-n^2 number of points – 1253. I tried padding them with zeros up to 2048 or doing the FFT on just the first 1024, ignoring the 229 remaining points and, finally, deleting every 6th point and then deleting every 52nd point and doubling the last point to get the necessary 1024. Ultimately, padding with zeros turned out to be the worst approach – couples of high and low bars repeat throughout the whole spectrum. Truncating the data (processing only the first 1024 points) appears to work the best. I would really like to know what someone with experience in signal processing would recommend as the best approach in producing the most realistic spectrum.

Here are examples of two different ways I applied the FFT on these data:

gggttt.host.sk/fig_truncated.jpg

gggttt.host.sk/fig_padded.jpg

gggttt.host.sk/fig_every_6th_and_52nd_point_deleted.jpg

回答1:

If you have exactly one period of data, you should use a FFT (or DFT if no fft is available) of exactly that length. In theory, FFTs are not limited to powers of 2 in length.



回答2:

Here is a PSD plot as generated by Octave (MATLAB clone) using all 1253 of your data points:

> t = load('sample.txt');
> m = mean(t)
m = -13.679
> periodogram(t,[],'onesided',1253,1e9)

As you can see, there is a large DC component and the non-DC components just look like a typical noise floor with no obvious peaks. My guess is that you'll need to collect more data if you suspect that there really are peaks buried in the noise - you may then be able to extract these using time averaging or ensemble averaging.


Here are just the first ten points of the PSD:

> Pxx = periodogram(t,[],'onesided',1253,1e9);
> plot(10*log10(Pxx(1:10)))