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

5 views (last 30 days)
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!

Accepted Answer

darova on 29 Dec 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

More Answers (1)

Image Analyst
Image Analyst on 29 Dec 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!