Implemntation of a Heart Rate Monitor in Matlab