ikarosilva / wfdb-app-toolbox

The WFDB Toolbox for MATLAB/Octave is a collection of functions for reading, writing, and processing physiologic signals in the formats used by PhysioNet (see README for details).
http://physionet.org/physiotools/matlab/wfdb-app-matlab/
GNU General Public License v3.0
93 stars 46 forks source link

Bug in tach #128

Closed opterix closed 8 years ago

opterix commented 8 years ago

When using tach function, the first two measures are always equal. I tried for several signals and I got that result. It seems very odd. Example:

aux=tach('a26', 'fqrs', [], [], 5) aux = 139.5350 139.5350 139.0680 138.8500

aux=tach('a27', 'fqrs', [], [], 5) aux = 80.0000 80.0000 133.7310 133.6320

aux=tach('a28', 'fqrs', [], [], 5) aux = 172.4140 172.4140 167.5200 171.1980

cx1111 commented 8 years ago

So it's not a bug with the matlab code, it's just a result of how the c code from the original wfdb software package was written. Description: "produces a uniformly sampled and smoothed instantaneous heart rate signal. Smoothing is accomplished by finding the number of fractional R-R intervals within a window (with a width of two output sample intervals) centered on the current output sample."

So it's rather difficult to provide a smoothed instantaneous heart rate for the very first window given that there are no samples are time t<0. I assume it will try to estimate it based on the next window or vice versa, hence the first 2 HRs being the same.