MATLAB Answers

FFT of sensor data

21 views (last 30 days)
Hello everyone!
I am a beginner in Signal processing. I have a time series plot of sensor data that has 200000 values. I need to calculate the FFT of the same data. When I perform fft(x), (assuming x is the time series signal), I get a plot with two peaks , one at 0 and one at 200000. The peak at 0 has an amplitude of 110 and the peak at 200000 has an amplitude of 7. The FFT should be mirror images. Why am I not observing any mirror images on this plot? The sample time of sensor is 0.01s (1000Hz).
Also I expect a resonant frequency of the sensor to be around 70-80 Hz. I do not see any peaks in the FFT at this frequency range. Please help.

Accepted Answer

Walter Roberson
Walter Roberson on 8 Jun 2017
The peak at 0 is equal to the sum of your readings. It would disappear if you were to subtract the mean of your readings from your input.
If your readings are real-valued, then the peak at the last bin is the complex conjugate of the peak at bin #2; both correspond to the lowest non-zero frequency.
Walter Roberson
Walter Roberson on 8 Jun 2017
One thing to keep in mind is that fft() assumes that the signal is periodic. If you cut the signal at a point that does not happen to be the end of all of the cycles, then you will get some edge effects leading to some unexpected frequencies showing up. There are two common cases for that:
  • if you zero-pad a signal, then you are effectively convolving it with a sync function, which will give you large narrow peaks near time 0 in the time domain, which would be high frequencies in the frequency domain
  • when people synthesize signals, it is common for them to use something like t = 0 : delta_t : 10 and then sin() or cos() of some integer frequency times 2 * pi of t. The problem with that is that it starts with a 0 (for sine) and ends with a zero (because the upper bound is an integer, multiplied by 2*pi times an integer), and since the signal is assumed to be periodic, that effectively gives you two 0's together. When you are synthesizing a signal, be sure to end one sample before the return to the original conditions.

Sign in to comment.

More Answers (1)

Santhana Raj
Santhana Raj on 8 Jun 2017
You are getting mirror images. except that matlab's FFT results are different from what you have read in your books. Normally FFT algorithm results are from -Fs/2 to +Fs/2, where Fs is the sampling frequency. Matlab's output gives from 0 to Fs. Saying that, if you want to see the plot from -Fs/2 to Fs/2, use the command fftshift.
Your peak at 0 frequency means there is a large DC value. To remove it, find the mean of x and subtract it from each and every value of x.
This should remove the mean value.
If your x has the senor's resonance, then it should be visible as soon as you have removed the mean. if not, provide the x data in the question, so that people can check it and give you better answers.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!