I'm looking for a way to estimate instantenous frequency with low time-variation. The following MATLAB function (save as
test_fest.m) does this using the Hilbert transform on a single 10 Hz sine tone. Sample rate
f_s is 1000 Hz.
function test_fest() %TEST_FEST() Test Frequency Estimation using Various Techniques. fS = 1000; f = '; % Sine Wave Frequency nFFT = fS; x = sin(linspace(zeros(length(f),1), f*2*pi, fS)); X = hilbert(x,nFFT); fE = diff(unwrap(angle(X))) * fS / (2*pi); % Frequency Estimate eE = mean((fE/f-1).^2); % MSQ Error plot(fE,'.'); title(sprintf('Hilbert Transform Instantaneous Frequency Estimation of Sine Wave f=%.2f Hz, f_S=%g Hz, Mean-Square Error:%.2g', f, fS, eE))
Output is shown here:
I, however, get a greater error,
2.3e-5, than I expected. Is there something wrong with my approach?