Hi
I'm calculating peak width using half-prominence method . For the peak in the rectangle is there is a method to make the horizontal line the finds the widths to shift up or make vertical line like this image
? . I tried both methods for peak width detection (half-width, half-prominence ) but it gave me the same results .
Half-prominence
close allorder =9 ;framelen =15;lx = 20;% generate sinal
x = 1:1:1432;y = (AV)';y = sgolayfilt(y,order,framelen);% get derivatives
dy = diff(y);dx = diff(x);dy_dx = [0 dy./dx]; findpeaks(y,x,'Annotate','extents','MinPeakProminence',0.006);% get peaks with width computed by 'findpeaks'
[pks,locs,peakWidth1,p] = findpeaks(y,x,'MinPeakProminence',0.006);
half-height :
order =7 ;framelen =11;x=-AV;lx = 20; sgf = sgolayfilt(x,order,framelen);hold on;sgf= 0.02-sgf;findpeaks(sgf,'MinPeakProminence',0.004,'WidthReference','halfheight','Annotate','extents');[pks,locs,widths,proms]=findpeaks(sgf,'MinPeakProminence',0.004,'WidthReference','halfheight'); pks = -pks;plot(locs,pks,'g*');text(locs+.02,pks,num2str((1:numel(pks))'));
Best Answer