How do I find the period or frequency of a signal?

288 views (last 30 days)
I currently have an array of data points which is clearly periodic and i can see the period just by lopoking at the graph, however how would i go about getting matlab to give me a readout of the period. One problem with finding the distance between peaks is that they are faily noisey so was thinking of finding distance between the dips, but i am having trouble workiing out how i would go about doing that.

Accepted Answer

Star Strider
Star Strider on 7 Mar 2018
I would first detrend (link) your data, then use findpeaks (link) to identify the peaks and their locations. Use the location information to calculate the period and from that, frequency.
  5 Comments
jb4earth
jb4earth on 19 Sep 2019
@Xu you are correct
PEAK period should be calculated as:
peak_wave_period = max(diff(your_time_vector(peaks)))
DoubleO7
DoubleO7 on 15 Oct 2019
I was wondering if anyone could expand upon this answer. What do you mean by time vector? Would an example of a time vector be:
tv = 1:100;
Is writing the following code correct for displaying the period?
[pks,locs] = findpeaks(data,tv)
period = max(diff(locs))
I appreciate your input.

Sign in to comment.

More Answers (1)

Dmitry Grigoryev
Dmitry Grigoryev on 14 Oct 2020
Edited: Dmitry Grigoryev on 14 Oct 2020
Start by substracting the sliding average from the raw signal.
Then shift the signal by rougly 1 period and use autocorrelation to find the exact period value.

Community Treasure Hunt

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

Start Hunting!