How to include peaks behind highest peak ?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi.. Iam trying to get list of peaks for the below attached plot.Iam able to get peaks list from x=3 onwards but iam trying to get peaks from x=2 onwards. I tried using findpeaks () and imregionalmax () functions this did not worked for me as I expected. And also tried this logic as well.. k= find (x(2:end-1)>=x(1:end-2) &x(2:end-1)>=x(3:end))+1;. Still same results were obtained as peaks from x=3 onwards. As Iam new to Matlab,I sincerely request that please can anyone help me out in solving this. Thanks in advance.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1039210/16557365300606711330750233495544.jpg)
1 件のコメント
Image Analyst
2022 年 6 月 20 日
Show your code. It should find all the peaks from the starting point on, that is at x=3, 9, and 14 once you add the starting index. Of you can use findpeaks and pass in both x and y.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
回答 (1 件)
Akash
2023 年 9 月 1 日
Hi Chaithra,
I understand that you are trying to obtain a list of peaks starting from "x=2", but the methods you have tried so far have not provided the expected results.
Upon examining the attached plot, I noticed that the point at "x=2" is not a peak but rather a point where the slope changes. At "x=2", the slope of the plot decreased. Peaks are typically identified as points where the neighboring points have lower magnitudes. The "findpeaks()" function in MATLAB is designed to return local maxima (peaks) of a given input signal vector. A local peak is defined as a data sample that is either larger than its two neighboring samples or equal to Inf. If a peak is flat, the function will only return the point with the lowest index.
In the plot you shared, "x=3" appears to be the first peak. As a result, the "findpeaks()" function will not identify "x=2" as a peak since it does not meet the criteria mentioned above.
If your objective is to identify all the change points in your data, I recommend exploring the "findchangepts()" and "ischange()" functions in MATLAB. These functions are specifically designed to detect change points in data. You can find more information about these functions in the MATLAB documentation, which I have provided links to below:
These functions will assist you in identifying the points where the slope changes, including "x=2" in your case.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!