-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfivebit.m
More file actions
60 lines (53 loc) · 1.03 KB
/
Copy pathfivebit.m
File metadata and controls
60 lines (53 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function ret = fivebit(dw)
% function to introduce 5 bit error in codeword
t=1;
[b a]=size(dw);
% first error generated
for i = 1:a
temp = dw;
if(dw(i)==0)
temp(i)=1;
else
temp(i)=0;
end
% second error generated
for j = i+1:a
temp2= temp;
if(temp(j)==0)
temp2(j)=1;
elseif(temp(j)==1 )
temp2(j)=0;
end
% third error generated
for r = j+1:a
temp3= temp2;
if(temp2(r)==0)
temp3(r)=1;
elseif(temp2(r)==1 )
temp3(r)=0;
end
% fourth error generated
for q = r+1:a
temp4= temp3;
if(temp3(q)==0)
temp4(q)=1;
elseif(temp3(q)==1 )
temp4(q)=0;
end
% fifth error generated
for p = q+1:a
k= temp4;
if(temp4(p)==0)
k(p)=1;
ret(t,:)=k;
t=t+1;
elseif(temp4(p)==1)
k(p)=0;
ret(t,:)=k;
t=t+1;
end
end
end
end
end
end