📄 depre_spatialmultiplexing.asv
字号:
function x=pre_spatialMultiplexing(y)
if num(v) = 2;%num(v) is the numbers of layers v;
if index_codeBook==0;
v1 = 1 /sqrt(2) * [1,1]';
v2 = 1 /sqrt(2) * [1,0;0,1];
elseif index_codeBook==1;
v1 = 1 /sqrt(2) * [1,-1]';
v2 = 1 /2 * [1,1;1,-1];
elseif index_codeBook==2;
v1 = 1 /sqrt(2) * [1,j].';
v2 = 1 /2 * [1,1;j,-j];
else index_codeBook==3;
v1 = 1 /sqrt(2) * [1,-j].';
v2 = [ ];
end;
else num(v) = 4;%num(v) is the numbers of layers v;
I = eye(4);
for n = 1:16;
W(n) = I - 2u(n) * u(n)' / (u(n)' * u(n));
end;
if index_codeBook==0;
u(1) = [1,-1,-1,-1].';
v1 = W1(;,1);
v2 = W1(:,[1,4]) /sqrt(2) ;
v3 = W1(:,[1,2,4]) /sqrt(3);
v4 = W1(:,[1,2,3,4]) /2;
elseif index_codeBook==1;
u(2) = [1,-j,1,j].';
v1 = W2(:,1);
v2 = W2(:,[1,2]) /sqrt(2);
v3 = W2(:,[1,2,3]) /sqrt(3) ;
v4 = W2(:,[1,2,3,4]) /2 ;
elseif index_codeBook==2;
u(3)=[1,1,-1,1].';
v1 = W3(:,1);
v2 = W3(:,[1,2]) /sqrt(2) ;
v3 = W3(:,[1,2,3]) /sqrt(3) ;
v4 = W3(:,[3,2,1,4]) /2 ;
elseif index_codeBook==3;
u(4) = [1,j,1,-j].';
v1 = W4(:,1);
v2 = W4(:,[1,2]) /sqrt(2) ;
v3 = W4(:,[1,2,3]) /sqrt(3) ;
v4 = W4(:,[3,2,1,4]) /2 ;
elseif index_codeBook==4;
u(5) = [1,(-1-j)/sqrt(2),-j,(1-j)/sqrt(2)].';
v1 = W5(:,1);
v2 = W5(:,[1,4]) /sqrt(2) ;
v3 = W5(:,[1,2,4]) /sqrt(3) ;
v4 = W5(:,[1,2,3,4]) /2 ;
elseif index_codeBook==5;
u(6) = [1,(1-j)/sqrt(2),j,(-1-j)/sqrt(2)].';
v1 = W6(:,1);
v2 = W6(:,[1,4]) /sqrt(2) ;
v3 = W6(:,[1,2,4])/sqrt(3) ;
v4 = W6(:,[1,2,3,4])/2;
elseif index_codeBook==6;
u(7) = [1,(1+j)/sqrt(2),-j,(-1+j)/sqrt(2)].';
v1 = W7(:,1);
v2 = W7(:,[1,3])/sqrt(2) ;
v3 = W7(:,[1,3,4])/sqrt(3) ;
v4 = W7(:,[1,3,2,4])/2;
elseif index_codeBook==7;
u(8) = [1,(-1+j)/sqrt(2),j,(1+j)/sqrt(2)].';
v1 = W8(:,1);
v2 = W8(:,[1,3])/sqrt(2) ;
v3 = W8(:,[1,3,4])/sqrt(3) ;
v4 = W8(:,[1,3,2,4])/2;
elseif index_codeBook==8;
u(9) = [1,-1,1,1].';
v1 = W9(:,1);
v2 = W9(:,[1,2])/sqrt(2);
v3 = W9(:,[1,2,4])/sqrt(3);
v4 = W9(:,[1,2,3,4])/2 ;
elseif index_codeBook==9;
u(10) = [1,-j,-1,-j].';
v1 = W10(:,1);
v2 = W10(:,[1,4])/sqrt(2) ;
v3 = W10(:,[1,3,4])/sqrt(3) ;
v4 = W10(:,[1,2,3,4])/2 ;
elseif index_codeBook==10;
u(11) = [1,1,1,-1].';
v1 = W11(:,1);
v2 = W11(:,[1,3])/sqrt(2) ;
v3 = W11(:,[1,2,3])/sqrt(3);
v4 = W11(:,[1,3,2,4])/2 ;
elseif index_codeBook==11;
u(12) = [1,j,-1,j].';
v1 = W12(:,1);
v2 = W12(:,[1,3])/sqrt(2);
v3 = W12(:,[1,3,4])/sqrt(3);
v4 = W12(:,[1,3,2,4])/2 ;
elseif index_codeBook==12;
u(13) = [1,-1,-1,1].';
v1 = W13(:,1);
v2 = W13(:,[1,2])/sqrt(2);
v3 = W13(:,[1,2,3])/sqrt(3) ;
v4 = W13(:,[1,2,3,4])/2 ;
elseif index_codeBook==13;
u(14) = [1,-1,1,-1].';
v1 = W14(:,1);
v2 = W14(:,[1,3])/sqrt(2) ;
v3 = W14(:,[1,2,3])/sqrt(3) ;
v4 = W14(:,[1,3,2,4])/2 ;
elseif index_codeBook==14;
u(15) = [1,1,-1,-1].';
v1 = W15(:,1);
v2 = W15(:,[1,3])/sqrt(2) ;
v3 = W15(:,[1,2,3])/sqrt(3) ;
v4 = W15(:,[3,2,1,4])/2 ;
elseif index_codeBook==15;
u(16) = [1,1,1,1].';
v1 = W16(:,1);
v2 = W16(:,[1,2])/sqrt(2);
v3 = W16(:,[1,2,3])/sqrt(3) ;
v4 = W16(:,[1,2,3,4])/2 ;
end;
end;
for i=1:M_ap;
M_ap=M_layer;
%index_CDD由高层给出;
if index_CDD=0;% without cyclic delay diversity ;
[Q,R]=qr(W);
x=R\(Q\y);
else index_CDD=1;%large delay CDD;
switch v
case 1
U = [1];
D(i) = [1];
case 2
U = 1/sqrt(2) * [1,1;1,exp(-j*pi)];
D(i) = diag([1,exp(-j*pi*i)]);
case 3
U = 1/sqrt(3) * [1,1,1;1,exp(-j*2*pi/3),exp(-j*4*pi/3);1,exp(-j*4*pi/3),exp(-j*8*pi/3)];
D(i) = diag([1,exp(-j*2*pi*i/3),exp(-j*4*pi*i/3)]);
case 4
U = 1/2 * [1,1,1,1;1,exp(-j*2*pi/4),exp(-j*4*pi/4),exp(-j*6*pi/4);1,exp(-j*4*pi/4),exp(-j*8*pi/4),exp(-j*12*pi/4);1,exp(-j*6*pi/4),exp(-j*12*pi/4),exp(-j*18*pi/4)];
D(i) = diag([1,exp(-j*2*pi*i/4),exp(-j*4*pi*i/4),exp(-j*6*pi*i/4)]);
end;
y(i) = W * D(i) * U * x(i); x(i)=
end;
end;
y;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -