# How can I find the width of the peaks when presented with a digital signal-like plot?

6 visualizaciones (últimos 30 días)
Akhil Kallepalli el 11 de Nov. de 2019
Comentada: Akhil Kallepalli el 11 de Nov. de 2019
My problem requires the measurement of the extent of these peaks (attached .fig and .jpg plot files) with respect to the base of the peaks (not FWHM).
For example, the first peak between (X=) 20 and 40 is spread across 32-36 X values. Therefore, my results should be 4.
This requires automation as it fits into a bigger problem statement I am working on.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Daniel M el 11 de Nov. de 2019
Editada: Daniel M el 11 de Nov. de 2019
Use the pulsewidth function with the argument MidPercentReferenceLevel set to 0 or 1 (the lowest value). Here is an example:
x = 1:50;
y = zeros(size(x));
y(33:35) = 1;
width = round(pulsewidth(y,1,'MidPercentReferenceLevel',1,'Tolerance',0.1));
width =
4
H = openfig('Query.fig');
C = get(H,'Children');
x = C(4).XData;
y = C(4).YData;
width = round(pulsewidth(y,1,'MidPercentReferenceLevel',1,'Tolerance',0.1))
width =
4 5 6 5
Alternatively, if your data contains only ones and zeros:
start1 = strfind([0,y],[0 1]);
end1 = strfind([y,0],[1 0]);
width = end1-start1+2
width =
4 5 6 5
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Akhil Kallepalli el 11 de Nov. de 2019
Works like a charm! Thank you :-)

Iniciar sesión para comentar.

### Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

R2018b

### Community Treasure Hunt

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

Start Hunting!

Translated by