?? sq64qam_gray_map.m
字號:
function out=sq64QAM_Gray_map(input)
%%%------example--------------------
%%% input=[0 1 1 0 1 1 0 1 1 0 0 1]
%%% out=[3+3j
%%% 5+3j]
%%%將輸入的信息比特流映射為方形64QAM星座點;輸出為并行序列,為表示星座點的復數
%%%輸入序列長度應為6的倍數;每6個比特映射為一個星座點
%%% 'input' is the inputed source bit sequence
%%% 'output' is the mapped constellations, and is a parallel sequence
K=length(input)/6; %%% The number of symbols
d=1/sqrt(42); %%% The minimum distance between constellations is 2*d
x=[7*d,5*d,3*d,d,-d,-3*d,-5*d,-7*d]; %%% coordinate matrix
y=[7*d,5*d,3*d,d,-d,-3*d,-5*d,-7*d];
for i=1:K %%%將input變成K×6的矩陣,便于映射處理,每一行對應一個星座點
for k=1:6
temp(i,k)=input(6*(i-1)+k);
end
end
%%% mapping --------------------------------
%%% Y-coordinate ---------------------------%%% 6個比特中的前三位決定縱坐標,后三位決定橫坐標
for i=1:K
if [temp(i,1),temp(i,2),temp(i,3)]==[0,0,0]
max(i,2)=y(1);
end
if [temp(i,1),temp(i,2),temp(i,3)]==[0,0,1]
max(i,2)=y(2);
end
if [temp(i,1),temp(i,2),temp(i,3)]==[0,1,1]
max(i,2)=y(3);
end
if [temp(i,1),temp(i,2),temp(i,3)]==[0,1,0]
max(i,2)=y(4);
end
if [temp(i,1),temp(i,2),temp(i,3)]==[1,1,0]
max(i,2)=y(5);
end
if [temp(i,1),temp(i,2),temp(i,3)]==[1,1,1]
max(i,2)=y(6);
end
if [temp(i,1),temp(i,2),temp(i,3)]==[1,0,1]
max(i,2)=y(7);
end
if [temp(i,1),temp(i,2),temp(i,3)]==[1,0,0]
max(i,2)=y(8);
end
end
%%% X-coordinate --------------------------
for i=1:K
if [temp(i,4),temp(i,5),temp(i,6)]==[0,0,0]
max(i,1)=x(1);
end
if [temp(i,4),temp(i,5),temp(i,6)]==[0,0,1]
max(i,1)=x(2);
end
if [temp(i,4),temp(i,5),temp(i,6)]==[0,1,1]
max(i,1)=x(3);
end
if [temp(i,4),temp(i,5),temp(i,6)]==[0,1,0]
max(i,1)=x(4);
end
if [temp(i,4),temp(i,5),temp(i,6)]==[1,1,0]
max(i,1)=x(5);
end
if [temp(i,4),temp(i,5),temp(i,6)]==[1,1,1]
max(i,1)=x(6);
end
if [temp(i,4),temp(i,5),temp(i,6)]==[1,0,1]
max(i,1)=x(7);
end
if [temp(i,4),temp(i,5),temp(i,6)]==[1,0,0]
max(i,1)=x(8);
end
end
clear i;
clear k;
clear temp;
for i=1:K
p_out(i,:)=max(i,1)+max(i,2)*j; %%% generate complex constellations,and parallel sequence
end
clear max;
out=p_out; %%% parallel complex constellations
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -