FFT - Return vector and Frequency display

2 views (last 30 days)
Anmol Pardeshi
Anmol Pardeshi on 15 Apr 2019
Edited: kholoud salameh on 31 May 2019
fft function - it returns a vector, same length as the signal, but if we plot the abs(signalFFT), the x axis does not quite depict the exact frequency, although it is very close. I would want to know how does this fft function works, what it exacts returns & how and what do I do to fix this.

Answers (1)

kholoud salameh
kholoud salameh on 31 May 2019
Edited: kholoud salameh on 31 May 2019
hi , if you try this code :
f = abs(fft(y));
plot(f)
it will plot y by sample at x-axis which is the length of f ! to get y by the exact frequency try this one :
f = abs(fft(y)); % calculate the magnitude of fft
index = 1:length(f);
index = index ./length(f) ;
index = index * fs ;
figure
plot(index,f); % plot frequency spectrum

Categories

Find more on Fourier Analysis and Filtering 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!