# How to calculate the peak-to-peak amplitude of a waveform?

108 visualizaciones (últimos 30 días)
Susan el 28 de Ag. de 2022
Comentada: Star Strider el 30 de Ag. de 2022
Hi All,
Sorry if I’m asking about the obvious, but could somebody please tell me how to calculate the peak-to-peak voltage of the following signal? I would like to know what the peak-to-peak amplitude of this signal is, and if I add random noise to it, how much the peak-to-peak amplitude will change. (fig file is attached)
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Star Strider el 28 de Ag. de 2022
Editada: Star Strider el 28 de Ag. de 2022
Fortunately, there are complete P-T complexes in thei record, making the calculations easier.
Detrending is important here in order to get uniform values. This requires a degree polynomial to detrend it adequately, something that to me is a bit extreme, however I could not get any other detrending approach (highpass filtering for example_ to give a satisfactory result. As a general rule, the R-wave is measured from the previous P-R interval, since that is considdered to be an isoelectric reference. This measures the peak-to-peak amplitude between the R-deflection and the following S-deflection, since that is the greatest difference —
Lines = findobj(LD, 'Type','line');
Xv = Lines.XData
Xv = 1×96918
0 0.0010 0.0020 0.0029 0.0039 0.0049 0.0059 0.0068 0.0078 0.0088 0.0098 0.0107 0.0117 0.0127 0.0137 0.0146 0.0156 0.0166 0.0176 0.0186 0.0195 0.0205 0.0215 0.0225 0.0234 0.0244 0.0254 0.0264 0.0273 0.0283
Yv = Lines.YData
Yv = 1×96918
-2756 -1795 -352 862 1680 2235 2610 2844 2987 3096 3180 3240 3274 3282 3287 3304 3321 3319 3310 3304 3308 3314 3322 3327 3325 3308 3284 3263 3251 3244
Fs = 1/(Xv(2)-Xv(1))
Fs = 1024
Yvf = detrend(Yv, 9);
Smin = islocalmin(Yvf, 'MinProminence',4000, 'MinSeparation',100);
Rmax = islocalmax(Yvf, 'MinProminence',5500);
Sdef = Yvf(Smin);
Rdef =Yvf(Rmax);
PtoP = Rdef - Sdef
PtoP = 1×126
1.0e+04 * 1.7004 1.6867 1.6795 1.7095 1.6755 1.6929 1.6930 1.6737 1.6954 1.6918 1.6742 1.7074 1.6843 1.6820 1.6982 1.6810 1.6881 1.6969 1.6653 1.6918 1.6900 1.6678 1.7032 1.6793 1.6807 1.7032 1.6761 1.6863 1.6948 1.6735
figure
plot(Xv, Yvf, 'DisplayName','Filtered EKG')
hold on
plot(Xv(Rmax), PtoP,'r+', 'DisplayName','P-P Values')
% plot(Xv(Rmax), Yvf(Rmax),'r^', 'DisplayName','R-Deflections')
% plot(Xv(Smin), Yvf(Smin), 'rv', 'DisplayName','S-Deflections')
hold off
grid
legend('Location','best')
xlim([0 5])
Make appropriate changes to get different results.
(Thanks again to @Karim, this time adapting his .mat file load approach to openfig.)
.
##### 16 comentariosMostrar 14 comentarios más antiguosOcultar 14 comentarios más antiguos
Susan el 30 de Ag. de 2022
@Star Strider Thank you so much for your time. I sincerely appreciate your help.
Star Strider el 30 de Ag. de 2022
As always, my pleasure!

Iniciar sesión para comentar.

### Más respuestas (1)

Abderrahim. B el 28 de Ag. de 2022
Hi!
Use peak2peak function. Demo below:
t = (1:length(ecgl))';
plot(t, ecgl)
peak2peak(ecgl)
ans = 2.1751
% You may need to detrend the ecg signal before finding peak to peak
% amplitude.
dt_ecgl = detrend(ecgl);
plot(t, dt_ecgl)
peak2peak(dt_ecgl)
ans = 2.0302
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Susan el 29 de Ag. de 2022
@Issa Thanks for your response! Appreciate it.

Iniciar sesión para comentar.

### Categorías

Más información sobre Signal Generation and Preprocessing en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by