MATLAB Answers

Translated by

このページのコンテンツは英語から自動翻訳されています。自動翻訳をオフにする場合は「<a class="turn_off_mt" href="#">ここ</a>」をクリックしてください。

sarmad m
0

findpeaks ( 'WidthRefe​rence','ha​lfheight' ) not finding width of peak

sarmad m
さんによって質問されました 2017 年 4 月 1 日
最新アクティビティ Matlaber
さんによって 回答されました 2019 年 1 月 14 日
Hi
I'm trying to find ( 'WidthReference','halfheight') something like this image
but it is not showing using this code , could you please show
me where is my error .
order =3 ;
framelen =13;
Averages=[R,L]';
Averages=mean(Averages)';
AV=smooth(Averages,6);
x=AV;
lx = 20;
sgf = sgolayfilt(x,order,framelen);
plot(sgf);
hold on;
findpeaks(sgf,'MinPeakProminence',0.003);
[pks,locs,widths,proms]=findpeaks(sgf,'Annotate','extents','WidthReference','halfheight');
pks= -pks;
plot(locs,pks,'g*');
text(locs+.02,pks,num2str((1:numel(pks))'));
this the output I get

  0 件のコメント

サインイン to comment.

3 件の回答

回答者: Greg Dionne
2017 年 4 月 4 日
 採用された回答

I think you wanted this instead:
findpeaks(sgf,'MinPeakProminence',0.003,'WidthReference','halfheight','Annotate','extents');
[pks,locs,widths,proms]=findpeaks(sgf,'MinPeakProminence',0.003,'WidthReference','halfheight');
(use the same settings for when you plot without output arguments vs. when you do your assignment).

  3 件のコメント

I did what you suggested to me like this : but again not showing the halfheight or peaks , what is wrong ?
order =9 ;
framelen =13;
x=-AV;
lx = 20;
sgf = sgolayfilt(x,order,framelen);
plot(sgf);
hold on;
sgf=-sgf;
findpeaks(sgf,'MinPeakProminence',0.006,'WidthReference','halfheight','Annotate','extents');
[pks,locs,widths,proms]=findpeaks(sgf,'MinPeakProminence',0.006,'WidthReference','halfheight');
pks = -pks;
plot(locs,pks,'g*');
text(locs+.02,pks,num2str((1:numel(pks))'));
It's probably not liking the fact that you're using the 'halfheight' flag with a negative baseline. Since your peak values are negative, your reference level needs to be brought up. My guess is you want to add +0.02 to sgf to bring up the baseline. (say "sgf = 0.02-sgf" instead of "sgf = -sgf".
thanks it works now

サインイン to comment.


回答者: sarmad m
2017 年 4 月 2 日

I'm using R2017a version .I tried the example that in the documentation and it shows the halfheight correctly . but when I try it on my data it not showing them

  0 件のコメント

サインイン to comment.


回答者: Matlaber
2019 年 1 月 14 日

Maybe you can paste your code here and have a look.
Are you able to find the peaks on your data?

  0 件のコメント

サインイン to comment.



Translated by