フィルターのクリア

How would I find the median RR interval in an ECG signal?

18 ビュー (過去 30 日間)
Cam B
Cam B 2022 年 10 月 30 日
コメント済み: William Rose 2022 年 11 月 3 日
If I have an ECG signal (.mat) that is sampled at 500 samples per second over 100 seconds, how would one calculate the median RR interval using findpeaks?

回答 (1 件)

Star Strider
Star Strider 2022 年 10 月 30 日
Perhaps this —
Fs = 500;
t = linspace(0, 100, 100*Fs)/Fs;
EKG = randn(size(t));
[pks, locs] = findpeaks(EKG, 'MinPeakProminence',5);
tv = t(locs);
RR = diff(tv);
RRmed = median(RR)
RRmed = 7.2201e-04
figure
histogram(RR)
xline(RRmed, '--', 'Median')
It would help to have the EKG record. I just used a random normal vector here.
.
  3 件のコメント
Star Strider
Star Strider 2022 年 10 月 30 日
The ‘5’ is the 'MinPeakProminence' value, chosen to fit the random data in ‘EKG’.
Yopu have to choose it to be appropriate to your EKG vector so that it detects only the R-deflections and not the P or T deflections (or noise).
William Rose
William Rose 2022 年 11 月 3 日
If the EKG signal is clean, you can use findpeaks() to find the R waves and the times of the R waves ([pks,locs]). This is what @Star Strider, M.D., did. Their signal was Gaussian white noise with mean=0, sd=1. You will have to find the parameters for findpeaks() that give reasonable results, i.e. which actually find the R waves. Do this by testing your algorithm on a 30 second segment, and plotting the EKG and the [pks,locs] found with findpeaks(). Once it looks reasonable, do it with the full length signal. Again, plot the signal and the [pks,locs], to check for reasonableness. Then you find (N-1) R-R intervals as the difference in (N) successive R wave times. Plot the (N-1) RR intervals versus the time of the first N-1 R waves. Does the plot look reasonable? If a few RR intervals are twice a big as the majority, you probably missed a few R waves. If a few RR intervals are much shorter than realistic, you are getting some false detections. Once you have fixed thise issues by appropriate choice of parameters for findpeaks(), you can find the median of the vector of R-R intervals.
If you are getting NaN, it probably means findpeaks() didn't find any peaks. That would happen if you specify a threshold, or a minPeakProminence, of five, and your signal amplitude never exceeds 1, for example.

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

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by