How to calculate the small changes in a signal?

40 vues (au cours des 30 derniers jours)
Susan
Susan le 31 Août 2022
Commenté : Susan le 9 Sep 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

Réponse acceptée

Star Strider
Star Strider le 31 Août 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 commentaires
Susan
Susan le 9 Sep 2022
@Star Strider Sure thing!

Connectez-vous pour commenter.

Plus de réponses (1)

dpb
dpb le 31 Août 2022
Modifié(e) : dpb le 31 Août 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 commentaires
Susan
Susan le 9 Sep 2022
@dpb Thank you so much for your input. Got it.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Analog Input and Output dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by