frequency vector in a fft
42 views (last 30 days)
I am trying to do the fft of a signal (here attached cc.txt), unfortunately I do not understand which frequency I should associate at each value of the fft, in other word I did not understand how to create the frequency vector. I have tried to apply what I've read here https://it.mathworks.com/help/matlab/ref/fft.html and I have done this code, but unfortunately the frequency vector and the fft have different lenght, so an error results.
Can you help, what I am doing wrong in this code and why???
Thank you in advance
f = Fs*(0:(L/2))/L;
Star Strider on 13 Jun 2019
That should do what you want. (It plots the ‘positive half’ of the fft result, from D-C (0 Hz) to the Nyquist frequency, and the correct amplitude, multiplying the returned amplitude by 2.)
More Answers (3)
Daniel Frisch on 31 Aug 2020
Edited: Daniel Frisch on 31 Aug 2020
You can use my little function called easyFFT that does exactly that for you: it calculates & returns a frequency vector along with the spectrum.