How to know about FFT bin frequencies
84 views (last 30 days)
Show older comments
Hi guys Im not used to computing fft on matlab and I have some doubts so if you could tell me if im right or wrong... My signal is h : N = 16384 Sampling frequency = 65536Hz
if I do : fft(h,65536) I should have a frequency step of 1Hz, right???? Like first bin stands for 0Hz, second for 1 Hz...
I would like to compute a FFT in the frequency range [0 - 6000 Hz] but with a 1 Hz frequency step. Could you help me please??
I would be very thankful for all answers and explainations ! Bye
0 Comments
Answers (5)
Star Strider
on 1 Dec 2015
The easiest way to find out is to do the experiment:
Fs = 65536; % Sampling Frequency (Hz)
Ts = 1/Fs; % Sampling Interval (sec)
Fn = Fs/2; % Nyquist Frequency (Hz)
L = 16384; % Signal Length (samples)
t = [0:(L-1)]*Ts; % Time Vector (sec)
s = cos(2*pi*100*t); % Signal (100 Hz)
FTs = fft(s,Fs)/L; % Experiment #1
Fv = linspace(0, 1, fix(Fs/2)+1)*Fn;
Iv = 1:length(Fv);
[PeakFTs,Idx] = max(abs(FTs(Iv))*2); % Find MAximum and Index
figure(1)
plot(Fv, abs(FTs(Iv))*2)
axis([0 500 ylim])
grid
text(Fv(Idx)+10, PeakFTs, sprintf('Peak at %.3f Hz, Index %d', Fv(Idx), Idx), 'HorizontalAlignment','left', 'VerticalAlignment','top')
0 Comments
Adam
on 1 Dec 2015
Edited: Adam
on 1 Dec 2015
A 65536-pt FFT would, in your case give 1Hz bins for a sample frequency of 65536 Hz.
If you only want the FFT from 0 to 6000 then just clip the result of the FFT to
y = fft( h, 65536 );
y = y(1:6001);
and this should give you the frequencies from 0 to 6000 at 1Hz intervals.
0 Comments
himanshu tripathi
on 8 Jun 2019
Please have a look at the code and plot of 1kHz frequency (file attached here).
There is a problem, why the reversed V-shaped plot is obtained in the frequency domain.
Note: Sample 1kHz signal data is attached.
And why Fv = linspace(0,1,fix(LF/2)+1)*Fn;
is used in the fft analysis and what is the concept of the nyquist frequency.
0 Comments
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!