how does the function findpeaks work in matlab?
7 ビュー (過去 30 日間)
古いコメントを表示
I use the function findpeaks to detect peak in a vector,it worked as i expected,but I want to understand how does it work,and what the principle it use.
n=0:1:10;
x = [25 8 15 5 6 10 10 3 1 20 7];
[k,v]=findpeaks(x);
plot(n,x,'b');grid;hold on
plot(n(k),v,'r.');
Can anyone can help me?I will be very appreciate for your kindness.
0 件のコメント
回答 (2 件)
Rik
2017 年 5 月 3 日
pks = findpeaks(data) returns a vector with the local maxima (peaks) of the input signal vector, data. A local peak is a data sample that is either larger than its two neighboring samples or is equal to Inf. Non- Inf signal endpoints are excluded. If a peak is flat, the function returns only the point with the lowest index.
So that's how it works.
2 件のコメント
Jan
2017 年 5 月 3 日
@yawen: It seems like you noticed, that the code is not readable. Please edit your comment and use the "{} Code" button for a proper formatting. Thanks.
yawen kang
2017 年 5 月 3 日
参考
カテゴリ
Help Center および File Exchange で 描述性统计量 についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!