# Weird results out of fourier transform of unknown signal, what am I doing wrong?

It has been a long time since I studied engineering, please forgive my mistakes.

I got data sampled from a digital accelerometer. It is sampled at 20 hz, then collapsed into 1 second epochs. The data is then filtered to remove noise. The system outputs 0 at rest, a lot more during activity.

I'm looking at the fourier transform of the signal, 1024 samples, sampled once per second. I'm seeing this:

Here's a real-imaginary plot of the real-imaginary results of the Fourier transform.

The signal appears to be a helix in frequency domain.The system appears to oscillate around some limit cycle within frequency domain.

Is this possible? Is Fourier transform completely wrong for the digital signal? Should using only the DFT for this kind of analysis? Is my window size wrong ? Am I seeing aliasing due to incorrect window size?

It has been a few years since my last engineering class, and I'd really appreciate any help on the subject. I got 3 books on engineering, signal analysis and transforms, but it takes time for this kind of knowledge to come back to me.

## migrated from electronics.stackexchange.comOct 25 '11 at 13:03

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

• I didn't look at this closely, but my immediate knee jerk reaction from seeing the plots is that you've got aliasing going on. – Olin Lathrop Oct 24 '11 at 12:52
• No, Fourier transform is not wrong for digital signals. Yes, you can only use the DFT with discrete signals. – endolith Oct 25 '11 at 14:46
• Does that graph of acceleration over time look like what you expect it to look like? – endolith Oct 25 '11 at 15:01
• The accelerometer graph looks good. I've double checked and what I'm plotting is the rate of change of acceleration above a certain moving average. It works as expected. Acceleration is present for a brief moment as the sensor is touched, then disappears. – Alex Stone Oct 26 '11 at 1:27

My guess: nothing to see here. Move along.

You mention that "the signal appears to be a helix in [the] frequency domain". I assert that what this helix really is, is a complex exponential. And there is nothing wrong with that, because complex exponentials are what you get when you time-delay a signal: $f(x-a)\Leftrightarrow \hat{f}(\xi)e^{-2\pi i a \xi}$. The helix pattern simply reflects that most of the power in the signal you are acquiring isn't located at $T=0$. (And it shouldn't be there anyway!)

Eyeballing, the period of oscillation in your frequency plot appears to be ~28 samples. At a sampling rate of 20hz, if what I'm saying is true, then most of the energy in your time-domain signal should be centered roughly around $t\approx\frac{28}{20}=1.4$ seconds. Was I close?

The real problem here is likely to be your plots. It seems like you're plotting raw real/imag DFT outputs. Don't do that. Instead, compute magnitude/phase from real/imag values, and plot that.

• Thank you ! I've cleaned up the helix, and it oscillates at 25 times per second. If I start to sample the signal at 25 hz, would I get most of my signal centered around within 1 second epochs? – Alex Stone Oct 26 '11 at 1:22
• I've heard before that the plots look weird. When I do simple FT with a sine wave or a sum of sine waves, I get peaks at the fundamental frequency, as expected. When I try to do the same with the data that I got, I'm getting weird results like this one. I will take a closer look at the magnitude of the bins. – Alex Stone Oct 26 '11 at 1:30
• That FFT plot is pretty normal. When you have time-domain data that has one big spike at one instant, and is close to zero elsewhere, then do the FFT on that data, then you are supposed to get that helix pattern (complex exponential) on the frequency plot. – David Cary Oct 26 '11 at 20:51

Possible thought starters:

Ensure that input to ADC is low pass filtered to well below half sampling rate to avoid aliasing. At 20 Hz sample you need either a "barn door" infinite cutoff low pass filter at 10 Hz or something real at somewhat lower. Sheet 21 has a feel of aliasing components, but maybe not.

1 second samples with a cutoff frequency below 10 Hz only gives you a few samples. I may be totally missing what you are really doing.

Windowing may be needed to handle other than complete waveform cycles included in the sampled window. For few samples and frequency components which have arbitrary parts of a cycle included in an FFT pass you can generate strong non-existent components.

FFT should deal with in-pass-band noise. Your "noise filtering" may also be data filtering. You need a Nyquist rate filter as above but then anything in the remaining passband is potentially legitimate signal.

• He said "digital accelerometer" which implies an accelerometer with built-in ADC and self-clocked sampling (eg, ADXL345). Such accelerometer presumably has anti-aliasing filters built-in. – markrages Oct 24 '11 at 0:45
• Yes, hopefully the accelerometer has anti-aliasing filters, but the OP needs to filter again, before he does the "collapsed into 1 second epochs", to get a signal that makes sense. – David Cary Oct 26 '11 at 20:53

What you are seeing is the fact that your 1 second "epoch" window is not synchronized to your data. The phase of the FFT results are relative to the edge of the window, and thus will rotate as your window edge moves along to different phase relationships with your signal.

If you actually care about phase or relative phase, lock the window offset to the period of your signal. If you don't care about phase just calculate the magnitude of the complex result and use that.

• This makes sense. the current window slides with the data. Do you have any suggestions on whether I should increase or decrease my window? – Alex Stone Oct 26 '11 at 1:24