خرید بک لینک

Vote count: 0

"hi This program in Matlab read two input file (file.txt and file2.txt) which has 80000 random number. when I execute the following program It has error(index out of bounds; value 1 out of bound 0 in Matlab). I am unable to fix this error. kindly I need i your help."

...........................
clear all close all rel=textread('file.txt'); ct=textread('file2.txt'); bh0=zeros(256,20000);
bh1=zeros(256,20000); Te2=[99 124 119 123 242 107 111 197]; for i=1:20000

    m(i)=bitxor(ct(16*(i-1)+1),180); 
    if m(i)==Te2(1)|m(i)==Te2(2)|m(i)==Te2(3)|m(i)==Te2(4)|m(i)==Te2(5)|m(i)==Te2(6)|m(i)==Te2(7)|m(i)==Te2(8)
        bh0(m(i)+1,i)=rel(1+4*(i-1));
    else   
        bh1(m(i)+1,i)=rel(1+4*(i-1));
    end
end

for k=1:256
    counter=1;
    for i=1:20000
        if bh0(k,i)~=0
            bh0_final(k,counter)=bh0(k,i);
            counter=counter+1;
        end
    end
end
for k=1:256
    counter=1;
    for i=1:20000
        if bh1(k,i)~=0
            bh1_final(k,counter)=bh1(k,i);
            counter=counter+1;
        end
    end
end

for i=1:20000
    ciphertext0(i)=ct(16*(i-1)+1);
    reload0(i)=rel(1+4*(i-1));
end
sum_c0=zeros(20000,256);
for i=1:20000
    for j=1:256
        if ciphertext0(i)==j
            sum_c0(i,j)=reload0(i);
        end
    end
end

counterr=zeros(1,256);
summ=zeros(1,256);
for i=1:20000
    for k=1:256
        if sum_c0(i,k)~=0
        counterr(k)=counterr(k)+1;
        summ(k)=summ(k)+sum_c0(i,k);
        end
    end
end
for k=1:256
    mean(k)=summ(k)/counterr(k);
end
var=zeros(1,256);
for i=1:20000
    for k=1:256
        if sum_c0(i,k)~=0
            var(k)=((sum_c0(i,k)-mean(k))^2)/counterr(k);
        end
    end

end

asked 57 secs ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 13 تير 1395 ساعت: 12:07

صفحه بندی