plot the result of findpeaks() and original signal on same plot

53 ビュー (過去 30 日間)
preeti visweswaran
preeti visweswaran 2017 年 4 月 18 日
コメント済み: Star Strider 2018 年 11 月 18 日
The plots of findpeaks() and original signal have different x axes scales,hence I am unable to overlay one on top of the other. Any help with this will be greatly appreciated!

採用された回答

Star Strider
Star Strider 2017 年 4 月 18 日
They actually do not have different scales. (We do not have your code, so I am guessing here.) The locations of the peaks returned by findpeaks are indices unless you gave it the x-vector as an argument. You can get the x-axis values with the appropriate reference.
Example
[pks,locs] = findpeaks(y);
x_peaks = x(locs);
figure(1)
plot(x,y, x_peaks,pks,'pg')
grid
See if that does what you want.
  14 件のコメント
Steven McLain
Steven McLain 2018 年 11 月 18 日
Thanks! This helped me too!
Star Strider
Star Strider 2018 年 11 月 18 日
@Steven McLain —
My pleasure!
A vote for it would be appreciated!

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

その他の回答 (0 件)

カテゴリ

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