function [amdf] = AMDF(y, Fs, delka_okna) 

    [Y, pocet_oken, pocet_vzorku_okna, ~] = SEG_A_DOPLN(y, Fs, delka_okna);
    
    
    for i = 1:pocet_oken
    
        for shift = 0:1:pocet_vzorku_okna-1
        
            for j = 1:pocet_vzorku_okna-shift            
                
                rozdil(j,shift+1) = Y(j+shift,i)-Y(j,i);
                        
            end
        
            amdf(i,shift+1) = sum( (abs(rozdil(:,shift+1)))/(pocet_vzorku_okna-shift) );
        
        end   
   
    end
    
end