Question: Matlab code to plot the power density spectrum for the time intervals obtained from R-R interval- Code tused until now to find R-R interval is
Matlab code to plot the power density spectrum for the time intervals obtained from R-R interval-
Code tused until now to find R-R interval is as follows:
clc;
load('ecg234m.mat'); %%%%%load the data into matlab
plotATM('ecg234m');
base= 1024;
gain= 200;
fs = 1000; % Sampling rate
val= (val-base)/gain; %generate a val matrix similar to the part 1 of this project
val=val(1:217000); % trmming for first 10minutesof the signal
interval=0.002777;
x=(1:size(val, 2)) * interval;
plot(x,val); % plotting the unfiltered data
xlabel('time(s)');
ylabel('amplitude');
title('ECG FOR RECORD 234');
figure;
value=(val(1:217000));
y=0.25*max(value);
[pks,locs]=findpeaks(value,'minpeakheight',y,'minpeakdistance',100);
plot(x,value,x(locs),pks,'Or')
title('QRS peaks');
QRSPEAK=x(locs); %%%%% finding for R-R interval, find the peak time
RRinterval=diff(QRSPEAK); % take the difference of consecutive peaks
avg=mean(RRinterval);
disp(avg);
plot(QRSPEAK(2:end),RRinterval)
title('R-R Interval of the Arrhythmic signal')
xlabel('time(s)')
ylabel('Duration of R-R interval ')
figure
Please explain the steps.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
