# How to calculate the small changes in a signal?

31 ビュー (過去 30 日間)
Susan 2022 年 8 月 31 日
コメント済み: Susan 2022 年 9 月 9 日
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

サインインしてコメントする。

### 採用された回答

Star Strider 2022 年 8 月 31 日
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 —
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)
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 件のコメント表示 70 件の古いコメント非表示 70 件の古いコメント
Susan 2022 年 9 月 9 日
@Star Strider Sure thing!

サインインしてコメントする。

### その他の回答 (1 件)

dpb 2022 年 8 月 31 日

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 件のコメント表示 13 件の古いコメント非表示 13 件の古いコメント
Susan 2022 年 9 月 9 日
@dpb Thank you so much for your input. Got it.

サインインしてコメントする。

### カテゴリ

Find more on Analog Input and Output in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by