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}$.