I need to implement this code as chaotic interleaver by using baker map

2 Ansichten (letzte 30 Tage)
this code of the 2d chaotic interleaver using baker map
clc
clearvars
N=8;
X=vec2mat(1:N*N,N);
B=zeros(N);
Sk=[0 2 4 2];
[~,key]=size(Sk);
row=N;
col=N;
for s=0:row-1
Ni=0;
for i=1:key-1
Ni=Ni+Sk(i);
ni=Sk(i+1);
for r=Ni:Ni+ni-1
q=N/ni;
nrow=q*(r-Ni)+mod(s,q);
ncol=((s-mod(s,q))/q+Ni);
B(r+1,s+1)=X(nrow+1,ncol+1);
end
end
end
the output must be as shown :
31 23 15 7 32 24 16 8
63 55 47 39 64 56 48 40
29 21 13 5 30 22 14 6
61 53 45 37 62 54 46 38
27 19 11 3 28 20 12 4
59 51 43 35 60 52 44 36
25 17 9 1 26 18 10 2
57 49 41 33 58 50 42 34
but the real output in this code dosen't match the correct output please if any one have a solution to this problem i need to help and thank you to every one answer me
B
B = 8×8
1 9 17 25 2 10 18 26 33 41 49 57 34 42 50 58 3 11 4 12 5 13 6 14 19 27 20 28 21 29 22 30 35 43 36 44 37 45 38 46 51 59 52 60 53 61 54 62 7 15 23 31 8 16 24 32 39 47 55 63 40 48 56 64

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by