finding the frequency of signal without using FFT
3 次查看(过去 30 天)
显示 更早的评论
hi all
I have sine signal with noise where the number of points of noise per oscillation should be the same in my code five points per oscillation) , I want to change each time the number of oscillation :2,3,4….15 ( in my code changing the vairable "random")
At each number of oscillation I shall extract the amplitude as a function of frequency < unfortunately for few oscillation FFT wouldn't work there are too few points in the signal , so I have to fit the signal ( sine with noise ) to sine wave in order to compare the frequency of new signal to the frequency of the sine wave
see my code? how can I do the fitting ,so I can extract the frequency of the signal
clc
random=40;
f=5; % the frequency of the sine wave also the number of points per oscillation
%the number of oscillation is random/f
t = (1:random)';
X = ones(random,2);
y_1= sin((2*pi)/f*t);
X(:,2) = y_1;
y=y_1+randn(random,1);
y = y(:);
beta = X\y;
yhat = beta(1)+beta(2)*sin((2*pi)/f*t);
figure
plot(t,y,'.b','markersize',12);
hold on
plot(t,yhat,'r','linewidth',2);
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!