how can find frequency from an fft function?
187 views (last 30 days)
hi, I'm doing a coupled oscillators experiment involving two measured angles changing over time. i imported the data -csv - with one column (867x1) for each variable; time, angle 1, angle 2.
when i enter: plot(abs(fftshift(fft(Y1)))); (where Y1 = the column vector for angle 1.) i am unsure of the meaning of the figure that is produced, specifically the numbers on the x axis.
i have been told that the y axis is the amplitude and that the x axis is the index, but i do not understand how i am meant to understand the frequency of the oscillation from these two things.
additionally every post i have found connected to this problem refers to the following equation: Frequency = i * (Fs/N)
am i correct in assuming that "i" is the x coordinate? that N is 867? and Fs i am entirely confused as to how to calculate.
i have attached the figure, please advise.
Guillaume on 22 Nov 2015
It sounds like you're lacking the basics of fourier transform analysis. You would probably better off learning about it before trying to apply it.
Yes, i is your sample number, your x, axis. N is the number of sample (usually you try to make it a power of 2). Fs is your sampling frequency. You must have acquired your measurement at a fixed frequency.
Star Strider on 22 Nov 2015
The current R2015b documentation is confusing (at least in my opinion). See the R2015a documentation for fft for a more appropriate implementation. The only correction that needs to be made to the code between the first two plot figures is to multiply the result of the fft by 2 with a one-sided fft.
This will give the correct amplitudes:
Y = fft(y,NFFT)*2/L;