How to find x range value and calculate average of corresponding peaks in a graph signal?

1 vue (au cours des 30 derniers jours)
Hi everybody,
I need help for this task: I have a graphs with irregular peaks derived from matrices data and I would like to automatically calculate for each set of data the x range where peaks occur and the mean value of each peak.
I hope I will be more clear showing an example. Every peak in the bigger graph corresponds to a series of irregular peaks (an example is shown in the little graph, which represents the first peak).
Thanks for attention!

Réponse acceptée

darova
darova le 29 Déc 2019
Try this;
index = find(y>100); % find peaks
ind = find( diff(x(index)) > 0.01 ); % find start and end of peak searies
index = [index(1) index(ind+1); % first row - start of series
index(ind) index(end)]; % second row - end series

Plus de réponses (1)

Image Analyst
Image Analyst le 29 Déc 2019
Try this:
threshold = 1000; % Whatever....
index1 = find(y > threshold, 1, 'first');
index2 = find(y > threshold, 1, 'last');
newY = y(index1 : index2); % Final result extracted from original y

Community Treasure Hunt

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

Start Hunting!

Translated by