function ANN_GQRS2=adjustGQRSByPeak(ANN_GQRS, ECG, Fs)

ANN_GQRS2=ANN_GQRS;

rangeN = round(Fs*0.1);

for i=1:length(ANN_GQRS)
    curPos = ANN_GQRS(i);
    for newPos =curPos:min(curPos+rangeN-1, length(ECG)-1)
        if ECG(newPos-1)<=ECG(newPos) && ECG(newPos+1)<=ECG(newPos)
            ANN_GQRS2(i) = newPos;
            break;
        end
    end
end