function helperPeakAnalysisPlot(t,smoothECG,locs_Qwave,locs_Rwave,locs_Swave,val_Qwave,val_Rwave,val_Swave,avg_riseTime,avg_fallTime,avg_riseLevel,avg_fallLevel)

%   Copyright 2012 The MathWorks, Inc.

figure
hold on
plot(t,smoothECG,'k','LineWidth',2)
plot(locs_Rwave(1),val_Rwave(1),'rv','MarkerFaceColor','r')
plot(locs_Qwave(1),val_Qwave(1),'rs','MarkerFaceColor','g')
plot(locs_Swave(1), val_Swave(1),'rs','MarkerFaceColor','b')
axis([123 260 -1.2 1.3])
set(gca,'xtick',[locs_Qwave(1),locs_Rwave(1),locs_Swave(1),260]);
set(gca,'ytick',[val_Swave(1),val_Qwave(1),val_Rwave(1),1.3])
legend('Smooth ECG Signal','Peak','Minima')
legend('QRS-Complex')
title('QRS-complex in an ECG signal','FontWeight','bold')
xlabel('Samples'); ylabel('Voltage(mV)')
grid on
 
% Display Properties on graph
text(locs_Qwave(1)-34,avg_riseLevel/2-0.2,['Avg. Rise level = ',num2str(avg_riseLevel)],'FontWeight','bold');
text(locs_Swave(1)-12,avg_fallLevel/2-0.6,['Avg. Fall level = ',num2str(avg_fallLevel)],'FontWeight','bold');
text(locs_Qwave(1)-19,val_Qwave(1)-0.75,['Avg. Rise time = ',num2str(avg_riseTime)],'FontWeight','bold');
text(locs_Swave(1)-19,val_Qwave(1)-0.75,['Avg. Fall Time = ',num2str(avg_fallTime)],'FontWeight','bold');
text(locs_Qwave(1)-2,val_Qwave(1)+0.17,'Q','FontSize',13,'FontWeight','bold');
text(locs_Rwave(1)-2,val_Rwave(1)+0.15,'R','FontSize',13,'FontWeight','bold');
text(locs_Swave(1)-2,val_Swave(1)+0.17,'S','FontSize',13,'FontWeight','bold');

end
