function [signal_b3] = Nelin_prizp(signal_a, signal_b, prebytek_bodu, rozestup)


    for i = 1:1:prebytek_bodu
        indexy(i) = 1+(i-1)*rozestup;
    end


    signal_b2 = signal_b;
    ind = zeros(1,prebytek_bodu);

    for i = 1:1:prebytek_bodu
    
        if i ~= prebytek_bodu

            for j = indexy(i+1)-i+1:rozestup:indexy(end)

                signal_b2(j) = [];
            
            end
        
        
            for k = indexy(i):1:indexy(i+1)-1
                
                signal_b3 = signal_b2;
                signal_b3(k) = [];
                podobnost = twosignalAMDF(signal_b3,signal_a);
                periodicita(k) = podobnost(1);
                signal_b3 = signal_b2;
            
            end
            
            val = min(periodicita);
            ind(i) = find(val==periodicita,1);                      %%%%%%% !!!jednicka
            signal_b3(ind(i)) = [];
            signal_b2 = zeros(numel(signal_b)-i,1);
            signal_b2 = [ signal_b3(1:indexy(i+1)-1-i); signal_b(indexy(i+1):end)];
        
        
        else
        
            for k = indexy(i):1:numel(signal_b2)
            
                signal_b3 = signal_b2;
                signal_b3(k) = [];
                podobnost = twosignalAMDF(signal_b3,signal_a);
                periodicita(k) = podobnost(1);
                signal_b3 = signal_b2;
            
            end
        
            val = min(periodicita);
            ind(i) = find(val==periodicita,1);
            signal_b3(ind(i)) = [];
            signal_b2 = signal_b3;        
        
        end
end


