How to plot RR interval?

55 views (last 30 days)
Luca Merolla
Luca Merolla on 23 Sep 2020
Commented: Bhupati kumar on 15 Oct 2020
Hello everyone!
I have an RR interval (attached) extracted from an ECG signal that was sampled at 500 Hz. The R peaks and their indices were extracted using findpeaks(), then the diff() function was used on the R indices (expressed in seconds) to calculate the RR interval. The RR interval was converted in milliseconds following the standard procedure. Below an extract from the code:
[qrspeaks, locs] = findpeaks(iwt, time, "MinPeakHeight", 0.5, ...
"MinPeakDistance", 0.42);
% RR interval
RR = diff(Rindex);
RR = RR'.*1000; % conversion in ms
Now I should plot this signal on the y-axis, while on the x-axis I should have the time (in seconds) at which the heart beat occurs.
I need the time in seconds of the RR interval also for the spline interpolation of the signal. I would like to start interpolating from the first value of the signal, so to avoid the extra values between 0 and the first value of the RRI. I attached a plot as an example to make myself more clear. Below the code for the interpolation:
x = 1:length(RR);
xq = 0:0.25:length(RR); % Instead of 0 I would like the first index value of the RRI
s = spline(x, RR, xq);
timespline = (1:length(xq))/4;
If you have different suggestions feel free to share, they're always welcome!
Thank you in advance for your reply!

Answers (0)

Community Treasure Hunt

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

Start Hunting!