function [ncc] = NCC(y1, y2) 
  
    pocet_vzorku_okna = length(y1);
    
    for shift = 0:1:pocet_vzorku_okna-1
        
        for j = 1:pocet_vzorku_okna-shift            
                
            citatel(j,shift+1) = ( (y1(j+shift)*y2(j)) ) ;
                                    
        end
        
        jmenovatel(shift+1) = sum(y2(1:end).^2) * sum(y2((1+shift):end).^2); 
        
        ncc(1+shift) = sum( citatel(:,shift+1) ) / sqrt( jmenovatel(shift+1) );
        
     end   
    
end