Skip to main content
To improve the clarify of the message
Source Link
cpmame
  • 41
  • 1
  • 4

Just caught my own mistake. The equation for method #2You are absolutely correct, the frequency resolution $f_R$ (or bin width) should be calculated based on the length of FFT, $N_{FFT}$ (i.e. $f_R=\frac{f_s}{N_{FFT}}$), instead of the length of the original captured signal $N$.

Y = Y + abs(fft(segment,512)/N);        % or N=8*512 
Y = Y + abs(fft(segment,512)?(8*512);

I have plottedbelieve most journals/books out there simply assume ($N=N_{FFT}$) in their sample calculation, and use the FFT outputnotation of $f_R=\frac{f_s}{N}$ throughout their books/papers. But when $N{\neq}N_{FFT}$ as in method #2, then the $f_R=\frac{f_s}{N}$ could to lead confusion among newbies (like myself). So a safer way is to use $f_R=\frac{f_s}{N_{FFT}}$ instead.

To prove this, below are the output of 5Hz + 30Hz sine wave on MATLABsinusoids ($f_s$=1024Hz, duration=4s, 4096 data points), and try to match upit's output with the frequency axes between those methodsFFT-512, and FFT-4096 respectively. I think it is safe to say FRYou can see the frequency resolution (or bin width) of anthe FFT-512 output, should be calculated based on the (3rd plot) is wider than FFT length-4096 $d_f = \frac{f_s}{N_F}$(2nd plot), wheresince $N_F$ = length of FFT$\frac{f_s}{512}>\frac{f_s}{4096}$.

enter image description here

Just caught my own mistake. The equation for method #2 should be

Y = Y + abs(fft(segment,512)/N);        % or N=8*512 
Y = Y + abs(fft(segment,512)?(8*512);

I have plotted the FFT output of a 5Hz + 30Hz sine wave on MATLAB and try to match up the frequency axes between those methods. I think it is safe to say FR of an FFT output, should be calculated based on the FFT length $d_f = \frac{f_s}{N_F}$, where $N_F$ = length of FFT.

enter image description here

You are absolutely correct, the frequency resolution $f_R$ (or bin width) should be calculated based on the length of FFT, $N_{FFT}$ (i.e. $f_R=\frac{f_s}{N_{FFT}}$), instead of the length of the original captured signal $N$.

I believe most journals/books out there simply assume ($N=N_{FFT}$) in their sample calculation, and use the notation of $f_R=\frac{f_s}{N}$ throughout their books/papers. But when $N{\neq}N_{FFT}$ as in method #2, then the $f_R=\frac{f_s}{N}$ could to lead confusion among newbies (like myself). So a safer way is to use $f_R=\frac{f_s}{N_{FFT}}$ instead.

To prove this, below are the output of 5Hz + 30Hz sinusoids ($f_s$=1024Hz, duration=4s, 4096 data points), and it's output with the FFT-512, and FFT-4096 respectively. You can see the frequency resolution (or bin width) of the FFT-512 output (3rd plot) is wider than FFT-4096 (2nd plot), since $\frac{f_s}{512}>\frac{f_s}{4096}$.

enter image description here

Source Link
cpmame
  • 41
  • 1
  • 4

Just caught my own mistake. The equation for method #2 should be

Y = Y + abs(fft(segment,512)/N);        % or N=8*512 
Y = Y + abs(fft(segment,512)?(8*512);

I have plotted the FFT output of a 5Hz + 30Hz sine wave on MATLAB and try to match up the frequency axes between those methods. I think it is safe to say FR of an FFT output, should be calculated based on the FFT length $d_f = \frac{f_s}{N_F}$, where $N_F$ = length of FFT.

enter image description here