Finding instantaneous BPM in EKG signal with a threshold

조회 수: 1 (최근 30일)
Alex Dimko
Alex Dimko 2020년 11월 6일
Hello,
I have this assignment where I have to find the instantaneous BPM of an EKG signal.
I did the first exercise where it was required to find a threshold.
Now my idea to calculate the BPM is to find the amount of times the threshold cuts the EKG signal and divide by 2(because it cuts each peak 2 times):
But when I run the code it does not seem to be reading the code in the if statement. I assume this might be the case because thefunction is not contnuous at every point but just connects discrete values?
Please help.
Code:
[t, data] = load_data("UE1.txt", 100);
N= 1:length(data);
average = mean(data);
threshold = max(data)*0.15;
vec = ones(1,length(data));
vec = vec.*threshold;
figure();
data = data';
vec = vec';
hold on
plot(t,data,'r');
plot(t, vec,'r--');
j=0;
for i = N
if data(i) == vec(i)
j = j+1;
disp(j);
end
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by