I want to get fft of vertical velocity and plot this data. But when I do fft, I got negative values also. How to get rid of this?
4 views (last 30 days)
Show older comments
I want to get fft of vertical velocity,w and plot this data. But when I do y=fft(w) I got negative values also. How to get rid of this? Does negative values always in fft results?
0 Comments
Answers (1)
Star Strider
on 1 Feb 2016
The fft produces complex output, so some of the values will be negative. To get the magnitude of the fft at various frequencies, use:
Y = abs(fft(w))/(length(w);
See the R2015a documentation for fft for details. Note especially the code between the first two plot figures.
1 Comment
Walter Roberson
on 1 Feb 2016
No, if you have real valued input then you might get complex conjugate in which the imaginary part is negative, but you will not necessarily get any negative real parts.
But if some real part comes out negative, so what? There are a lot of different velocity changes whose Fourier might be completely real valued but still has negative parts. In particular anything that looks like an impulse (a velocity spike) is going to Fourier to something like a sinc signal which is going to have negative components.
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!