How to calculate the small changes in a signal?

27 visualizaciones (últimos 30 días)
Susan
Susan el 31 de Ag. de 2022
Comentada: Susan el 9 de Sept. de 2022
Hi all,
I have an ECG signal and would like to know what minor amplitude changes I can recognize. The goal is to see if I'm able to get the resolution that's provided by the recording system or not. I use the gradient function to calculate the derivative and look at the minimum value to determine the resolution. I would like to know if this is the best approach to take or not. The signal is attached here. Any suggestions would be appreciated.
Fs = 1024; % sampling rate
Ft = gradient(data, 1/Fs)
min(Ft) % the smallest change in the signal's amplitude

Respuesta aceptada

Star Strider
Star Strider el 31 de Ag. de 2022
Iam not certain what result you want, however to get the smallest amplitude change, using gradient on the original signal is likely not going to produce the result you want, since the minimum gradient is going to be the minimum of the entire record, likely returning the value of the deepest Q- or S-deflection. Taking the gradient of the abolute value instead may do what you want.
Try this —
LD = load(websave('A','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1112930/A.mat'));
data = LD.A;
Fs = 1024;
L = numel(data)
L = 86549
t = linspace(0, L-1, L)/Fs;
Ft = gradient(data, 1/Fs);
[minFt,idx] = min(abs(Ft)) % the smallest change in the signal's amplitude
minFt = 0
idx = 22
minidx = find(Ft == min(abs(Ft)))
minidx = 3223×1
22 35 93 94 95 96 97 98 99 100
Ft2 = gradient(Ft); % Second Derivative
resolution = diff(data);
min_resolution = min(resolution(resolution>0))
min_resolution = 1
figure
subplot(2,1,1)
plot(t, data, 'DisplayName','Data')
hold on
plot(t(minidx), data(minidx), '+r', 'DisplayName','Gradient = 0')
hold off
grid
title('Original')
legend('Location','best')
xlim([0, 10])
subplot(2,1,2)
plot(t, Ft, 'DisplayName','Gradient')
grid
title ('Derivative')
xlim([0, 10])
That returns several values of a flat gradient, all representing inflection points in the EKG trace. Calculating the second derivative will allow the determination of the inflection points being a minimum, maximum, or saddle point. This may be helpful, however I am not certain what you want.
The minimum resolution appears to be equal to 1, however that likely needs to be calibrated with respect to the actual voltage values of the EKG (the R-deflection is normally about 1±0.2 mV) to be useful. It will likely be necessary to check the gain on the instrumentation.
.
  71 comentarios
Star Strider
Star Strider el 9 de Sept. de 2022
As always, my pleasure!
It’ill be interesting to see the results, and I hope they’ll lead to some insight into this. I suggest recording the same signal with different instrumentation parameters in different runs in order to understand how they relate to the recorded signal. (I wish I’d thought of that a few days ago!)
This may be the information we need. If not, well, at least we considered that approach.
Susan
Susan el 9 de Sept. de 2022
@Star Strider Sure thing!

Iniciar sesión para comentar.

Más respuestas (1)

dpb
dpb el 31 de Ag. de 2022
Editada: dpb el 31 de Ag. de 2022
We've elsewhere determined the data are recorded as signed 16-bit integers which span +/-32K which is a 64K range. A default double has approximately 15 decimal digits of precision (53 bits in the significand) so it can easily hold all the precision available from the instrument without any loss.
Given the number of possible inputs from the device is only the 64K unique values, any more than that number of unique values in a processed input signal will have come only as artifacts during the calculations as long as the calculations are on a per channel basis.
  14 comentarios
dpb
dpb el 9 de Sept. de 2022
As @Star Strider commented above, start simple with sine wave of known amplitude and frequency. What you have for test gear will control the "how" and what can be done easily, of course. I'm such an old guy and been out of consulting gig for 20+ years now and what I had then was easily 10 years out of being current I really don't have a handle on any of the current stuff on the market; either from the traditional vendors like Tektronix nor any of the now-ubiquitous miniature stuff built around the PC or a standalone device.
The signal generator doesn't even have to be a calibrated source, precisely, if you have a scope or a DVM -- you can tee the signal into it as well as into the device to measure the voltage...
Susan
Susan el 9 de Sept. de 2022
@dpb Thank you so much for your input. Got it.

Iniciar sesión para comentar.

Categorías

Más información sobre Applications 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