# how to set RBW while using medfreq ?

11 views (last 30 days)
LO on 7 May 2019
Edited: LO on 7 May 2019
Is there a mathematical/precise way to calculate an optimal rbw (resolution bandwidth) while using the command medfreq to calculate the frequency of a signal (sinewave in my case) in matlab?
the tutorial of the function just indicates:
"Resolution bandwidth, specified as a positive scalar. The resolution bandwidth is the product of two values: the frequency resolution of the discrete Fourier transform and the equivalent noise bandwidth of the window used to compute the PSD."
so the first one is Fs / Nfft (with Fs = sampling freq and Nfft the number of data points per each analysis window of the fft).
I am having some doubts about the other parameter, i.e. the noise bandwidth
is this formula correct ?
example (hanning window, 1024 samples)
Fs = 20000 Hz
Nfft = 2^10 = 1024
bw = enbw(hanning(Nfft)) = 1.4985
RBW = (Fs/Nfft)/bw
If I use this formula I estimate an RBW of 13 Hz ca. MATLAB gives me an error saying that the minimum valule expected as RBW is 19.something Hz.. Any idea of why ?