필터 지우기
필터 지우기

How do i calculate the frequency of signal with low sampling rate

조회 수: 3 (최근 30일)
Matthias
Matthias 2014년 5월 26일
댓글: Star Strider 2014년 5월 27일
I've got a sinusoidal signal with a low sampling rate:
x = 0:0.2*pi:6*pi;
y = sin(x) -0.25 + 0.5* rand(size(x));
Is the a fast and accurate way to determine the frequency of this signal? The only way I can think of is to make a fit, but with 4 parameters:
A*sin(B *x + C) + D
it is quite hard to make a good guess and therefore have a fast program. Are there other methods to determine the frequency, like e.g. pulse counting?
  댓글 수: 2
rifat
rifat 2014년 5월 26일
why dont you take FFT?
Matthias
Matthias 2014년 5월 27일
Isn't the spectral resolution of the FFT not much worse than the spectral resolution of a simple sin fit?

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2014년 5월 26일
Plotting it, the sampling rate is significantly higher than the Nyquist frequency, so the FFT will be reasonably accurate:
x = 0:0.2*pi:6*pi;
t = x/(2*pi); % Time vector (added)
y = sin(x) -0.25 + 0.5* rand(size(x));
figure(1)
plot(x, y, '.-')
grid
fty = fft(y);
afty = abs(fty);
fvrs = [0:fix(size(fty,2)/2)]*0.2*pi; % Frequency rad/t
fvHz = [0:fix(size(fty,2)/2)]*0.1; % Frequency Hz
lenv = 1:size(fvHz,2);
figure(2)
plot(fvHz, afty(lenv))
grid
I display the fft here in cycles/time (assume Hz). Substitute the frequency vector ‘fvrs’ in the plot to see it in radians/time. The frequency is about 0.25 Hz.
It’s not difficult to do a nonlinear regression using fminsearch or any of the other nonlinear regression routines. You can express your function as an ‘anonymous function’ and use it to fit your data. The function name ‘fitsin’ is already a function handle, so you don’t have to use the initial ‘@’ when referring to it in your code or as an argument to the fitting function.
fitsin = @(b,x) b(1).*sin(b(2).*x + b(3)) + b(4);
Use the frequency data from the fft for your initial estimate for b(2), and define the others as 1, unless you already have an idea of their values.
  댓글 수: 2
Matthias
Matthias 2014년 5월 27일
I already have a good idea what the frequency is going to be, I just want to characterize the deviation from main supposed frequency. So I could skip the FFT part and just use a fit, which is my current method.
Star Strider
Star Strider 2014년 5월 27일
I’ve fit periodic functions using regression functions similar to ‘fitsin’ with the various nonlinear solvers and fminsearch (with an OLS objective function). The advantage of starting with the FFT is that it gives you a reliable estimate of the predominant frequency as one of your initial parameter estimates. I’ve had nonlinear solvers fit harmonics instead, the reason I suggested the FFT.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spectral Estimation에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by