The document describes an algorithm for detecting R-peaks in an electrocardiogram (ECG) signal using MATLAB. It involves several steps: (1) removing low frequency components from the ECG signal using FFT, (2) finding local maxima using a windowed filter, (3) removing small values and storing significant peaks, (4) adjusting the filter size and repeating steps 2-3. The algorithm is demonstrated on two ECG data samples, showing the processed signal and detected peaks at each step. Finally, the document explains how to implement the algorithm in a neural network using the MATLAB Neural Network Toolbox.