What is the meaning of "width" and "prominences" in findpeaks

조회 수: 47 (최근 30일)
Matlaber
Matlaber 2019년 2월 7일
댓글: Star Strider 2021년 7월 12일
It said that:
[pks,locs,w,p] = findpeaks(data) additionally returns the widths of the peaks as the vector w and the prominences of the peaks as the vector p.
w is the widths of the peaks as the vector w
I still unable to find out how they calculate the width.
In the example below:
x = linspace(0,1,1000);
Pos = [1 2 3 5 7 8]/10;
Hgt = [4 4 2 2 2 3];
Wdt = [3 8 4 3 4 6]/100;
for n = 1:length(Pos)
Gauss(n,:) = Hgt(n)*exp(-((x - Pos(n))/Wdt(n)).^2);
end
PeakSig = sum(Gauss);
Plot the individual curves and their sum
plot(x,Gauss,'--',x,PeakSig)
grid
findpeaks(PeakSig,x,'MinPeakProminence',2,'Annotate','extents','WidthReference','halfheight')
[pks,locs,w,p]= findpeaks(PeakSig,x,'MinPeakProminence', 2,'Annotate','extents','WidthReference','halfheight')
title('Signal Peak Widths')
w =
0.2352 0.1725
p =
4.8721 3.0028
Is the w is the width (half-height) and p is height as pointed in the plot?

채택된 답변

Star Strider
Star Strider 2019년 2월 7일
Is the w is the width (half-height) and p is height as pointed in the plot?
Your interpretation of ‘p’ is correct. The value of ‘w’ returned depends on how you define 'WidthReference' (link). You can define it to be full width half maximum (FWHM) if you define it as 'halfheight'.
  댓글 수: 5
Duy Tran
Duy Tran 2021년 7월 12일
is it possible to get the endpoints (data points) of the widths apart from the distance?
Star Strider
Star Strider 2021년 7월 12일
It would be necessary to know the half-prominence height (‘y’ value that is apparently half the ‘y’ value of the tallest peak) and then use interp1 to calculate at least one of the ‘x’ values, then adding or subtracting the FWHM value to get the second ‘x’ value. (That could be something of a challenge in the examples in this illustration.)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by