Main Content

Determine Peak Widths

Create a signal that consists of a sum of bell curves. Specify the location, height, and width of each curve.

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

Figure contains an axes object. The axes object contains 7 objects of type line.

Measure the widths of the peaks using the half prominence as reference.

findpeaks(PeakSig,x,'Annotate','extents')

Figure contains an axes object. The axes object contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent signal, peak, prominence, width (half-prominence).

Measure the widths again, this time using the half height as reference.

findpeaks(PeakSig,x,'Annotate','extents','WidthReference','halfheight')
title('Signal Peak Widths')

Figure contains an axes object. The axes object with title Signal Peak Widths contains 6 objects of type line. One or more of the lines displays its values using only markers These objects represent signal, peak, height, width (half-height), border.