function [QRSo,diffo]=findBestQRS1(yp,QRS,QRS1,QRS2,QRS3,QRS4,QRS5)
% [averageDiff,~,~]=findPCGpeaksNewFeatures2(yp);
% Diffv=abs(diff(Indexes(:,1)));
lle=length(yp);



QRSa=QRS;
QRSc=[QRS1,round(lle/3)-1+QRS2,round(2*lle/3)-1+QRS3];
QRSb=[QRS4,round(lle/2)-1+QRS5];
lena=length(QRSa);lenb=length(QRSb);lenc=length(QRSc);
[maxlen,maxlenI]=max([lena,lenb,lenc]);
% [maxlen,maxlenI]=max([lena,lenc]);
diffa=diff(QRSa);
diffb=diff(QRSb);
diffc=diff(QRSc);
QRSo=QRSa;
switch maxlenI
    case 1
        QRSo=QRSa;
        diffo=diffa;
    case 2
        %45
        [mindiff,mindiffi]=min(diffb);
        meandiff=mean(diffb);
        if mindiff<0.2*meandiff
            QRSb(mindiffi+1)=[];
        end
        QRSo=QRSb;
        diffo=diffc;
    case 3
        %123
        meandiff=mean(diffc);
        ff=find(diffc<0.2*meandiff);
        QRSc(ff+1)=[];
        QRSo=QRSc;
        diffo=diffc;
end
if length(QRSo)<=3
    [~,QRSo,~]=pt(yp,300);
end
