Solved!
% Function to Generate ECG of heart beat signal for specified duration
%---------------------------------------
function [Heartbeat,t] = ECG_Gen (HR,pulse_width,Amp,duration)
Fs = 48000;
delay = (60/HR);
t = 0 : 1/Fs : duration; % 48000 kHz sample freq for duration (secs)
d = 0 : delay : duration;
Heartbeat = Amp*pulstran(t,d,'tripuls',pulse_width);
I'm having problem outputting my generated Heart beat signals, when I play the signal using Sound in matlab and measure it on an external heart rate monitor. I get a different reading to the simulated value. But seem to be correct only at 60 Bpm to maybe 100 Bpm. Need to include heart rates up to 200 Bpm. In order words, I get a lot of unstable output at high Bpm.