The MATLAB code for the QRS Detection program and also the sample ECG files which are used by the MATLAB code (ECG3.dat, ECG4.dat, ECG5.dat, ECG6.dat). 

I have added a lot of comments in the code (before each step) so that it is understandable. 

We have taken the input signal as an ECG signal from the MIT-BIH Arrhythmia Database ("http://physionet.ph.biu.ac.il/physiobank/database/mitdb/")

The sequence of filtering operations in the algorithm have been indicated below:

SEQUENCE OF FILTERING OPERATIONS

Description: http://gyazo.com/d4005922e7044d1957af8d82b9049a5f.png?1325795405


So, in short, the algorithm accepts an input ECG signal and outputs the QRS complex wave, as shown below:

INPUT OF THE SYSTEM
Description: http://gyazo.com/6f2a4f87ca0bdb95bf2c8ca72f453923.png?1325795423

OUTPUT OF THE SYSTEM
Description: http://gyazo.com/c9b53aa0dfc6dea05d133673be19b227.png?1325797338

Once the QRS Wave has been detected from the input ECG signal (as shown above), it can be used for detection of cardiac abnormalities using the following table (from Wikipedia):

Description: http://gyazo.com/966cf9e7bac70db84bd4913c378e441d.png?1325797345