How to detect a peak from a 2D graph

52 ビュー (過去 30 日間)
Evans Gyan
Evans Gyan 2019 年 4 月 27 日
回答済み: Zhangxian Deng 2024 年 7 月 19 日
I want to find the x, and y values that makes up the peak. I have attach the image for better clarification. I tried to use the codes below to obtain the values. There are three peaks but i get extra peaks from my code. Besides, i have trouble finding the rigth X, and Y values that makes up the peaks. Your assistance is highly appreciated.
tt1=0:1:90;
tt2=0:1:90;
figure(1)
PPM=10*log10(PPM);
figure(1) %???
mesh(tt1,tt2,PPM)
%axis([0,90,0,90])
xlabel('x')
ylabel('y')
[pks,locs] = findpeaks(PPM);
angs = tt1(locs)';
angs = tt2(locs)';
untitled.png
  1 件のコメント
Rik
Rik 2019 年 4 月 27 日
I don't have the required toolbox, so I can't test this myself, but have you tried the other inputs and output of findpeaks? Specifically the prominence? That sounds like something you could try. If you are certain there will always be exactly 3 relevant peaks, you could even use it to select the 3 peaks with the highest prominence.

サインインしてコメントする。

回答 (1 件)

Zhangxian Deng
Zhangxian Deng 2024 年 7 月 19 日
MATLAB introduced a new function called "islocalmax2" in R2024a.

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by