finding the frequency of signal without using FFT
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Spectral Measurements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!