Missing points before and after the R peaks

I have a signal which I want to segment in heartbeats. I have the location of the R peaks and want to create a sliding window which takes 100 points before and 100 points after each peak, but before the first beat are just 78 points and after the last peak are also less than 100.
How can I avoid those peaks and just select the beats that have enough points before an after the R-peak?

댓글 수: 4

Rik
Rik 2021년 2월 9일
That depends on how you are applying your sliding window. The solution will be either trivial or difficult depending on those details.
Ioana Cretu
Ioana Cretu 2021년 2월 9일
편집: Ioana Cretu 2021년 2월 9일
Thank you for your response Rik.
I do that with a for statement
before=100; after=100;
for i=1:length(qrs_i)
beat(i,:)=ECG(qrs_i-before:qrs_i+after);
end
where qrs_i is a vector with the index position of the R peak in the ECG signal
Can you please tell me how I show modify it for what I want to do?
Rik
Rik 2021년 2월 9일
Don't you mean a for-loop? If that is the case you could compute the indices first and use continue if any of them is invalid.
sorry I used a for loop, idk why I wrote if

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

답변 (1개)

Rik
Rik 2021년 2월 9일

1 개 추천

Something like this is what I meant:
before=100; after=100;
for n=1:numel(qrs_i)
ind=(qrs_i(n)-before):(qrs_i(n)+after);
if ind(1)<1 || ind(end)>numel(ECG), continue, end
beat(n,:)=ECG(ind);
end

댓글 수: 2

Thank you Rik! This is exactly what I needed
darova
darova 2021년 2월 9일

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

카테고리

도움말 센터File Exchange에서 Get Started with Signal Processing Toolbox에 대해 자세히 알아보기

질문:

2021년 2월 9일

댓글:

2021년 2월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by