2
$\begingroup$

so I've been attempting to do a FFT on some data and I'm seeing a peak at 0Hz, which I can't really comprehend why since I'm quite new to signal processing. I read in my file using pandas, saved them to arrays and used scipy's FFT function on the y data. But when plotting it against a frequency linspace the results seem odd to me. I'm not quite sure how to get the time domain into the frequency domain. Any help would be much appreciated, thank you. (Note: The data isn't perfectly horizontal).

$\endgroup$
  • 1
    $\begingroup$ Show the plot, please, and tell us in general what data you're taking. $\endgroup$ – TimWescott May 11 at 20:37
  • $\begingroup$ Most probably your data has some DC bias. I don't see any detrending or windowing -- am I missing it? $\endgroup$ – TimWescott May 11 at 20:39
  • $\begingroup$ On the $[0,2000]$ interval, I can spot something like an $y$ offset above the decaying trend. Or a little jump around $2000$. Once you remove the trend, this might be seen as a two-level bias, of very low sequency, which could explain the remaining low-frequency component in the FFT $\endgroup$ – Laurent Duval May 12 at 10:26
  • $\begingroup$ @Boyon I'd be happy to redact the edits, but can you please leave a question that can be answered or delete the whole thing? I can redact after you delete. $\endgroup$ – Peter K. May 13 at 17:43
  • $\begingroup$ @PeterK. I can leave a question sure, but I haven't been able to delete it since it got a lot of attention. I even emailed the website and they said they wouldn't, which I'm surprised given the nature of my request. $\endgroup$ – Boyon May 13 at 18:24
7
$\begingroup$

[EDITED FROM DISCUSSION]

On the first order, your data looks like a decay with a positive origin on a small-valued range $[0.7 \; 0.49]\times 10^{-7}$, and very tiny fluctuations with respect to the area under the curve.

So from afar, your data is much closer to an almost constant function than to some putative oscillations. So the the zero, or DC-component, is important. Indeed, the amplitude of your maximum FFT is around $5.9 \times 10^{-7}$, which happens to match the average value of your data, if I use the trapezoidal approximation $(0.7+0.49)/2= 0.595$ (I hope your FFT is normalized).

For second order observations, you can try to remove the exponential-looking decay trend (by an exponential fit, or a low-degree polynomial, of 2nd or 3rd order for instance). With the sufficiently dense number of points, you can also try again on the derivative (taking care of end-points) or second derivative, to see if periodic phenomena appear. But this is likely to amplify noise.

At the third order, on the index interval $[0,\,2000]$, I see a kind of dropout around an order of magnitude of $0.05 \times 10^{-7}$. Once you remove the trend, this could appear like a single step down, which may cause a low-frequency effect in your signal.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ For sure, I'll give it a try and get back to you. Thanks again. $\endgroup$ – Boyon May 11 at 22:35
  • 1
    $\begingroup$ If there's a peak close to zero then you've probably done your best. If there's a peak at zero then you can force it to zero by subtracting whatever residual mean there is after subtracting out the parabola, or by choosing a way to compute the parabola that forces its mean to equal your data's mean. $\endgroup$ – TimWescott May 12 at 0:58
  • 1
    $\begingroup$ Manually removing some low-frequency component before doing a FT is a bit like digging a hole for a single potato right before ploughing the entire field. $\endgroup$ – leftaroundabout May 12 at 11:49
  • 1
    $\begingroup$ @CarlWitthoft yeah... though a) FFT is so cheap and double-precision so abuntant that there's no need to worry except in extreme applications b) scaling up before or after trafo doesn't make any difference in floating-point c) hm, doesn't the outermost recursion of an FFT basically calculate average and remove that anyway? Not sure right now if that's equivalent to the manual version. $\endgroup$ – leftaroundabout May 12 at 13:22
  • 3
    $\begingroup$ @TimWescott right, the real problem is that Fourier doesn't like nonperiodic functions and thus it makes sense to fake periodicity with a window. $\endgroup$ – leftaroundabout May 12 at 16:31
4
$\begingroup$

Because your data is (I assume) composed of some interesting stuff times a teeny number, plus the -- presumably uninteresting -- $k_0 + N\,k_1 + N^2\,k_2$, where $N$ is your "epoch".

So the Fourier transform of the data as a whole is dominated by the Fourier transform of $k_0 + N\,k_1 + N^2\,k_2$.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.