findpeaks ( 'WidthReference','halfheight' ) not finding width of peak
Show older comments
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

Accepted Answer
More Answers (2)
sarmad m
on 2 Apr 2017
0 votes
1 Comment
Amanda Figueroa
on 4 Jun 2019
Edited: Amanda Figueroa
on 4 Jun 2019
I had the same issue until I removed the outputs (pks, locs, widths,proms)
[pks,locs,widths,proms] = findpeaks(Peaks(:,2),Peaks(:,1),...
'MinPeakHeight',4e7,'MinPeakProminence',4e6,'Annotate','Extents'...
);
The plot should show up if you remove them as shown below:
findpeaks(Peaks(:,2),Peaks(:,1),...
'MinPeakHeight',4e7,'MinPeakProminence',4e6,'Annotate','Extents'...
);
And this is my plot (zoomed in):

Matlaber
on 14 Jan 2019
0 votes
Maybe you can paste your code here and have a look.
Are you able to find the peaks on your data?
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

