-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmimo_decoding.m~
39 lines (36 loc) · 1.23 KB
/
mimo_decoding.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
function [ stream ] = mimo_decoding( input_virtual_antennas, H ,P )
%% TODO
%Constellations = [0+0i, 0+1i, 1+0i, 1+1i];
%H = H(1:P.RakeFingers,:,:);
MIMO_in = P.nMIMO*P.RakeFingers;
len_inp = length(input_virtual_antennas);
Constellations = [1+1i ,-1-1i];
%Constellations = [1 ,-1];
%y = reshape(input_virtual_antennas,len_inp,MIMO_in);
%y=input_virtual_antennas;
%y = [input_virtual_antennas(:,1,1) input_virtual_antennas(:,1,2) input_virtual_antennas(:,2,1) input_virtual_antennas(:,2,2)];
y = input_virtual_antennas;
%G = pinv(Hresh'*Hresh)*Hresh';
%G = pinv(H);
chan_out_1 = zeros(1,len_inp);
chan_out_2 = zeros(1,len_inp);
for i = 1:len_inp
y1 = y(:,i);
%sTilde = G*(y1.');
sTilde1 = H\y1;
Sravn = zeros(length(Constellations),1);
sHat = zeros(length(sTilde1),1);
sHat_dist = zeros(length(sTilde1),1);
for ii=1:length(sTilde1)
for j=1:length(Constellations)
Sravn(j) = abs(sTilde1(ii)-Constellations(j));
end;
[sHat_dist(ii), sHat(ii)] = min(Sravn);
end;
%sHat = argmin ot rasstoyaniya % daet chislo v const ot 0 - 15
%sHat = sHat - 1;
chan_out_1(i) = Constellations(sHat(1));
chan_out_2(i) = Constellations(sHat(2));
end;
stream = ([chan_out_1, chan_out_2]<0);
end