Identification and correction of detection errors on QRS-beat sequences This algorithm identifies anomalies like FP, FN or ectopic beats. The FP and FN are corrected by deleting or inserting one or multiple beats. INPUT: QRSindex: Sample values of the detected QRS-Complexes(minimum (8+(Nmax-1)Samples) Fs: Sample Frequency Nmax: Maximum number of insertions, deletions, movements at one position (default = 20) OUTPUT: QRStime_corr: Time values of the corrected QRS-Complexes dr: Time values of the derivative of the original instantaneous heart rate: dr = 2 * | (t(k-1) - 2t(k) + t(k+1)) / ((t(k-1) - t(k))*(t(k-1) - t(k+1))*(t(k) - t(k+1))) | dr_corr: Time values of the derivative of the corrected instantaneous heart rate: U: Calculated threshold for dr (Umax = 0.5 [s-2]) ANNOT: Structure that annotates the corrected and uncorrected beats ANNOT: ANNOT.ins: Time values of all inserted beats ANNOT.del: Time values of all deleted beats ANNOT.mov: Time values of all moved beats ANNOT.NOR: Time values of all uncorrected beats [QRStime_corr,ANNOT] = qrscorr(QRSindex,Fs,Nmax); Example: [QRStime_corr,ANNOT] = qrscorr(QRSindex,256,15); Reference: [1] J. Mateo, P. Laguna, Analysis of Heart Rate Variability in Presence of Ectopic Beats Using the Heart Timing Signal IEEE Transactions on biomedical engineering, Vol.50, No.3, March 2003