Saturday, September 16, 2017

matlab - Specific Frequency Resolution


I have an audio signal


SampleRate Fs: 44100 Hz

TotalSamples: 94144 samples

Duration t: 2.1348 s

The frequency resolution is given by Fs/N where FS is the input signal's sampling rate and N is the number of FFT points used.


If I want to have 10Hz frequency resolution (bins of 10Hz), I should use 4410 FFT-points (44100/4410 = 10) but fft(signal,N) function of matlab specifies that N (4410 in my case) should greater than the signal length (94144 in my case). How should I proceed?




Answer



There are some important clarifications out of this question that are good to point out:


The frequency resolution of a block of data is 1/T where T is the length of the data in time (in seconds). Since the sampling rate and block length are related as


$T = N/f_s$


Where $f_s$ is the sampling rate, it follows that the frequency resolution for a block of N samples will be $1/T = f_s/N$.


Zero padding does not change the frequency resolution, it only interpolates more samples of the Discrete Time Fourier Transform. See these posts:


What happens when N increases in N-point DFT


What proportion of a padded FFT should be actual values


When you do fft(signal,N) in Matlab, N must be larger or equal to the signal length and when larger it will simply append zeros, so identical to zero padding.


So to achieve a 10 Hz resolution bandwidth, you either need to reduce the number of samples, as in fft(sig(1:m)), or reduce the sampling rate, but regardless of sample rate, the length of the block in your fft must be 1/10 = 0.1 seconds long.



Note that windowing if performed will expand the frequency resolution; the finest resolution is achieved with no windowing and is $f_s/N$


Refer to this paper by fred harris which details the resolution bandwidth for various windows: fred harris on the use of windowing


No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...