linear Interpolation for RR interval

조회 수: 8 (최근 30일)
David De Querol
David De Querol 2022년 5월 23일
댓글: David De Querol 2022년 5월 25일
Good morning everyone!
My goal is to use linear interpolation on the RR-interval, which was created out of an ECG signal.
The result should look similar to the following image, but with a varying frequency (that means the period of 100 Samples should vary depending on the distance from the variable locs_Rwave -> see figure 2 for an example):
and the following image shows an interval from the ECG_signal, in which the values of
  • locs_Rwave(16) = 2083
  • locs_Rwave(17) = 2197
  • locs_Rwave(18) = 2310
are the "starting point" and "end point - 1" in which they should have the previous values of -pi and +pi.
I cutted up the for-loop to the interval from i=16:18 to make my question clear.
function [] = interpolation()
% Load the database
template= load('UnoVis_auto2012.mat');
% Extract the record of interest, from 1 to 31
record=template.unovis(1);
[totalHR, hrB2b, cECG_1, cECG_2, cECG_3, refECG] = extractHR(record);
[RR_2,RR_loc_2] = RRInterval(cECG_2,record);
[RR_difference_2 RR_location_2, locs_Rwave] = plotQRS(cECG_2);
%% The interpolation question starts here :)
% function interp1( param1, param2, param3, 'linear' )
X = [0:100];
absPi = ([0:0.01:1]*2*pi)-pi; %absPi must have the same length as X
for i = 16:18
if i==length(locs_Rwave)
break;
end
frame = (locs_Rwave(i):1:(locs_Rwave(i+1))-1)/((locs_Rwave(i+1)-locs_Rwave(i))/100); % HERE IS MY PROBLEM (or so i think)
linearInterpolation = interp1(X , absPi , frame , 'linear');
array{i} = linearInterpolation;
end
disp('done')
end
With this previous code, I obtain the cell-array - array{i} - with all values empty (aka NaN). My guess is that the parameter -frame- is the one causing me problems. The frame parameter (for i=16) bring an 1x114 double, which starts on 2083 and ends on 2196.
Can you help me out here? What am I missing?
PS: If there´s any important information I missed to share, please tell.
Thank you,
David
  댓글 수: 2
Jeffrey Clark
Jeffrey Clark 2022년 5월 24일
Yes, the calculated frame must contain values in [0..100]. So didn't you want something like this?
frame = (0:100/(locs_Rwave(i+1)-locs_Rwave(i)+1):100);
David De Querol
David De Querol 2022년 5월 25일
Thank you very much Jeffrey Clark. It indeed worked.
For anyone interested, the result along the whole spectrum is showned below (kinda cool, eh?) :)
Cheers!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by