MATLAB Answers

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

3 views (last 30 days)
Flavia Lerra
Flavia Lerra on 29 Dec 2019
Answered: Image Analyst on 29 Dec 2019
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!

  0 Comments

Sign in to comment.

Accepted Answer

darova
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

  0 Comments

Sign in to comment.

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

  0 Comments

Sign in to comment.

Sign in to answer this question.


Translated by