function disp_ecg2hr(ecgt,ecg,ecgfilt,rr,hr,threshold,thresheld,beats)
    subplot(511);
    hold off;
    plot(ecgt,ecgfilt,'r',ecgt,threshold,'g');
    hold on;
    stem(ecgt(beats), -.5*ecgfilt(beats));
    hold off;
    subplot(512);
    hold off;
    plot(ecgt,thresheld .* (thresheld > 0));
    hold on;
    stem(ecgt(beats),thresheld(beats), 'r');
    subplot(513);
    hold off
    plot(ecgt,ecg,'r');
    hold on
    stem(ecgt(beats),ecg(beats));
    subplot(514);
    plot(ecgt(beats(1:(length(beats)-1))),rr);
    subplot(515);
    plot(ecgt,hr);
