function  PeakIndex=peakdetection_lal(wave,fs,dilation,thrhd,Loop)
wave_diff=diff(wave);
wave_diff=[0 abs(wave_diff)];
Peakindex=peakdetection(wave_diff,fs,dilation,thrhd,Loop);
PeakIndex=zeros(1,length(Peakindex));   
L=18;
for I=1:length(Peakindex)
    if Peakindex(I)<=L
        temp_Peak=1:Peakindex(I)+L;
    elseif Peakindex(I)>length(wave)-L
        temp_Peak=Peakindex(I)-L:length(wave);
    else
        temp_Peak=Peakindex(I)-L:Peakindex(I)+L;
    end
    temp_wave=wave(temp_Peak);
    [~,PeakIndex(I)]=max(temp_wave);
    PeakIndex(I)=PeakIndex(I)+temp_Peak(1)-1;
end
PeakIndex=PeakIndex';
end
