How to find frequency of wave data

57 Ansichten (letzte 30 Tage)
Marcella Roth
Marcella Roth am 18 Mär. 2021
Kommentiert: Harish S. am 27 Feb. 2025 um 9:47
Hi, I have a set of data (shown below) and I would like to get the frequency of the wave Thank you!
So far I have tried:
a=readmatrix(sprintf('sampledata')) %read in data
x=a(:,2)
t= a(:,1)
z = x(t>171 & t<174.5)
zz = t(t>171 & t<174.5)
% Get sine fit
F = fit(zz, z, 'sin1');
% Plot result
plot(F,zz,z);
grid on;
xlabel('Time (secs)');
ylabel('Amplitude');
title(['Estimated frequency = ', num2str(F.b1/(2*pi)), ' Hz']);
and I get a frequnecy of 0.00075267 Hz
I can see by hand counting that the frequency is about 27-28. Any help is appreciated!

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 18 Mär. 2021
I would probably try to use findpeaks. With the right setting, you can use that to count the number of peaks. You could also do this interactively using the find local extrema live task in a live script.
  8 Kommentare
Marcella Roth
Marcella Roth am 22 Mär. 2021
Thank you so much for your help, I really appreciate it!
Harish S.
Harish S. am 27 Feb. 2025 um 9:47
Helpfull

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by