Error in Heart Rate Calculation

5 views (last 30 days)
Shraddha Joshi
Shraddha Joshi on 23 Apr 2016
Below is the code I have used in Pan Tompkins Algorithm to calculate Heart Rate:
N=length(ecg_h); duration_in_sec=N/fs; duration_in_min=duration_in_sec/60; Heart_Rate=beat_count/duration_in_min;
where, beat_count=beat_count+1 as used in lines 337 and 377 in file attached below. This is because beat counts refer to dominant R-peaks detected in Pan Tompkins Algorithm. But the error I am getting is
Undefined function or variable "ecg_h".
Error in pan_tompkin2 (line 133) N=length(ecg_h);
Could you please where I am going wrong and how to debug this error? Also I want to know how can I store all these heart rates calculated for different signals to be stored in an array?

Answers (0)

Categories

Find more on Biomedical Signal Processing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!