How to find corresponding peaks between two datasets using timestamps

10 次查看(过去 30 天)
Hi everyone,
I have a 2 datasets (Dataset_Black and Dataset_Grey) of which peaks are known to follow each other up. Now I am trying to automatically select peaks throughout the whole dataset (which consists over 2018-2020). See below: the related peaks are circled, as you can see each peak of the black Dataset_Black is followed by a smaller peak in Dataset_Grey. In the end I need the maximums of each corresponding peak in order to test whether a larger peak in Dataset_Grey indeed is preceded by a larger peak in Dataset_Black.
I selected the peaks in the grey dataset I want to analyse using:
[pks_grey loc_grey]=findpeaks(Dataset_grey.fixed_10mins, 'MinPeakDistance', 1, 'MinPeakHeight', 350, 'MinPeakProminence', 200);
This gives me a dataset of 114 time locations and their value. How can i use this to find the accompying preceding peaks in the blackline?
Or does someone have a better way to find and select these peaks?
  4 个评论

请先登录,再进行评论。

回答(1 个)

KSSV
KSSV 2020-9-15
Read about knnsearch. Provide the locations of Grey data and get the distance, nearest points to Black data. By checking the distance or the respective locations, you can pick your required values.
  5 个评论
bas zaalberg
bas zaalberg 2020-9-16
Thanks a lot for all your help.
I got it working by determining the minimum and maximum lag of each peak, substracting this of the indices belonging to the peaks of Dataset_Grey. Then by using the Max() function, i found the value and the location of these peaks.
Cheers

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by