-
Notifications
You must be signed in to change notification settings - Fork 13
/
Constell_Mapping.m
103 lines (99 loc) · 3.94 KB
/
Constell_Mapping.m
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
function B = Constell_Mapping(A, Sam)
[M,N] = size(A);
B = zeros(M*sqrt(length(Sam)), N);
%%
if length(Sam) == 4
for m=1:M
B((2*m-1),:) = real(A(m,:));
B((2*m),:) = imag(A(m,:));
end
B(B>0) = 1;
B(B<0) = 0;
elseif length(Sam) == 16
for n=1:N
for m=1:M
if A(m,n) == Sam(1)
B((4*m-3),n) = 1;
B((4*m-2),n) = 0;
B((4*m-1),n) = 1;
B((4*m),n) = 0;
elseif A(m,n) == Sam(2)
B((4*m-3),n) = 0;
B((4*m-2),n) = 1;
B((4*m-1),n) = 1;
B((4*m),n) = 0;
elseif A(m,n) == Sam(3)
B((4*m-3),n) = 0;
B((4*m-2),n) = 1;
B((4*m-1),n) = 0;
B((4*m),n) = 1;
elseif A(m,n) == Sam(4)
B((4*m-3),n) = 1;
B((4*m-2),n) = 0;
B((4*m-1),n) = 0;
B((4*m),n) = 1;
elseif A(m,n) == Sam(5)
B((4*m-3),n) = 1;
B((4*m-2),n) = 1;
B((4*m-1),n) = 1;
B((4*m),n) = 0;
elseif A(m,n) == Sam(6)
B((4*m-3),n) = 0;
B((4*m-2),n) =1;
B((4*m-1),n) = 1;
B((4*m),n) = 1;
elseif A(m,n) == Sam(7)
B((4*m-3),n) = 0;
B((4*m-2),n) = 0;
B((4*m-1),n) = 0;
B((4*m),n) = 1;
elseif A(m,n) == Sam(8)
B((4*m-3),n) = 1;
B((4*m-2),n) = 0;
B((4*m-1),n) = 0;
B((4*m),n) = 0;
elseif A(m,n) == Sam(9)
B((4*m-3),n) = 1;
B((4*m-2),n) = 1;
B((4*m-1),n) = 1;
B((4*m),n) = 1;
elseif A(m,n)== Sam(10)
B((4*m-3),n) = 0;
B((4*m-2),n) = 0;
B((4*m-1),n) = 1;
B((4*m),n) = 1;
elseif A(m,n) == Sam(11)
B((4*m-3),n) = 0;
B((4*m-2),n) = 0;
B((4*m-1),n) = 0;
B((4*m),n) = 0;
elseif A(m,n) == Sam(12)
B((4*m-3),n) = 1;
B((4*m-2),n) = 1;
B((4*m-1),n) = 0;
B((4*m),n) = 0;
elseif A(m,n) == Sam(13)
B((4*m-3),n) = 1;
B((4*m-2),n) = 0;
B((4*m-1),n) = 1;
B((4*m),n) = 1;
elseif A(m,n) == Sam(14)
B((4*m-3),n) = 0;
B((4*m-2),n) = 0;
B((4*m-1),n) = 1;
B((4*m),n) = 0;
elseif A(m,n) == Sam(15)
B((4*m-3),n) = 0;
B((4*m-2),n) = 1;
B((4*m-1),n) = 0;
B((4*m),n) = 0;
else
B((4*m-3),n) = 1;
B((4*m-2),n) = 1;
B((4*m-1),n) = 0;
B((4*m),n) = 1;
end
end
end
end
end