1

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

ganzewoort
  • 111
  • 2
  • 5
  • Sorry - I hadn't picked up from your previous question that you have exactly one period of data, so my previous suggestions re windowing etc were off base. One thing I notice form your data is that you have a very large (negative) DC component, and the non-DC peaks are relatively small compared to the noise floor - is that what you expect ? – Paul R Jan 09 '12 at 17:05
  • Here's what I'm getting -- This figure shows the result from the FFT when data are padded w/ zeros to 2048: http://gggttt.host.sk/fig_padded.jpg . Here is the figure with 1024 data points under FFT (the remaining 229 points ignored): http://gggttt.host.sk/fig_truncated.jpg . And this link shows the result when every 6th and then every 52nd point is deleted and the last data point is doubled: http://fig_every_6th_and_52nd_point_deleted.jpg . – ganzewoort Jan 09 '12 at 20:29
  • Sorry - I get `Forbidden. You don't have permission to access /fig_truncated.jpg on this server.` – Paul R Jan 09 '12 at 22:20
  • I get the same message sometimes. Please try the address without the http:// and see if you can open the pic. – ganzewoort Jan 09 '12 at 22:39
  • @Paul R, I need the DC component in combination with the non-DC one. The non-DC component is part of the useful signal and should be clearly above the noise. – ganzewoort Jan 10 '12 at 08:34
  • I plotted the periodogram of your data in Octave (MATLAB clone) and I don't see any useful peaks - it just looks like a large DC component and an 1/f noise floor - sorry. – Paul R Jan 10 '12 at 08:51
  • @Paul R, this interests me a lot. How can we discuss it more? Because I'm a new participant, I can't use the chat. Do you think I should open a new question or there other ways in this site to discuss issues? – ganzewoort Jan 10 '12 at 13:11

2 Answers2

0

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.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
  • Excel will not accept data other than powers of 2 in length. If I can do FFT otherwise (using some king of macro in Excel) whereby all the 1253 points can be processed that would be much preferable that using the FFT Excel add-in. – ganzewoort Jan 10 '12 at 08:37
0

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)

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)))

plot (10*log10(Pxx(1:10)))

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • Could you plot only the first ten bins? – ganzewoort Jan 10 '12 at 13:41
  • No problem - added to answer above (note that for this second plot the X axis is bin number (1-based) rather than frequency) – Paul R Jan 10 '12 at 13:52
  • It appears that at least the offset peak (at 0Hz) and the fundamental (~800kHz) are seen clearly. One may consider even the second harmonic (third bin) to be above the noise floor. This is all there is to it. No other peaks are expected to be seen at higher frequencies, if I understand the graph correctly. – ganzewoort Jan 10 '12 at 14:00
  • Seems like this one: gggttt.host.sk/fig_every_6th_and_52nd_point_deleted.jpg is the closest to what you have presented. How are the dB values calculated from the moduli? – ganzewoort Jan 10 '12 at 14:07
  • The dB values are just the usual `10*log10` (see Octave code above). If you are expecting your peaks to lie within these first few bins then you probably need to either collect more data (at least 10x more points) or low pass filter and downsample (decimate) and get more resolution that way. – Paul R Jan 10 '12 at 14:17
  • I'm looking at the Excel plot -- the 0Hz peak and the fundamental are practically of the same order of magnitude. Indeed, the second harmonic is approx. two magnitudes lower but the floor appears another magnitude down. Shouldn't this be enough to claim these three peaks given that this picture is readily reproducible? Also, it would be nice to see in Excel how these dB data are obtained. – ganzewoort Jan 10 '12 at 15:05
  • I don't think you can reliably say that there are any valid peaks - if you look at the variance in the noise floor then any apparent peaks are almost certainly not statistically significant. You need more data points. – Paul R Jan 10 '12 at 15:09
  • It appears that the variances of the noise floor are of at least an order of magnitude lower than the second harmonic, let alone the fundamental (I'm talking about the Excel graph; I still don't understand how the octave data can be obtained in Excel). – ganzewoort Jan 10 '12 at 15:20