-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDeepSIC_Test1.m
More file actions
151 lines (117 loc) · 4.36 KB
/
DeepSIC_Test1.m
File metadata and controls
151 lines (117 loc) · 4.36 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
% Test DeepSIC with binary constellations
clear all;
close all;
clc;
rng(1);
global v_fConst;
%% Parameters setting
s_nN = 4; % Number of Rx antennas
s_nK = 4; % Number of transmitted symbols
v_fSNRdB = 0:2:14; % SNR values in dB.
s_nIter = 5; % Interference cancellation iterations
s_fTrainSize = 5000; % Training size
s_fTestSize = 20000; % Test data size
s_fEstErrVar = 0.1; % Estimation error variance
% Frame size for generating noisy training
s_fFrameSize = 500;
s_fNumFrames = s_fTrainSize/s_fFrameSize;
s_fNumTestFrames = s_fTestSize/s_fFrameSize;
% Select which decoder to simulate
v_nCurves = [... % Curves
1 ... % Soft IC, perfect CSI
1 ... % Soft IC, CSI uncertainty
1 ... % Seq. DeepSIC, perfect CSI
1 ... % Seq. DeepSIC, CSI uncertainty
];
s_nCurves = length(v_nCurves);
v_stPlots = strvcat( ...
'Iterative SIC, perfect CSI',...
'Iterative SIC, CSI uncertainty',...
'Seq. DeepSIC, perfect CSI', ...
'Seq. DeepSIC, CSI uncertainty' ...
);
% Generate channel matrix
m_fH = zeros(s_nN, s_nK);
for ii=1:s_nN
for jj=1:s_nK
m_fH(ii,jj) = exp(-abs(ii-jj));
end
end
% BPSK constellation
v_fConst = [-1 1];
fSymToProb = @(x)0.5*(x+1);
fProbToSym = @(x)sign(x-0.5);
%% Simulation loop
m_fBER = zeros(s_nCurves, length(v_fSNRdB));
% Generate training symbols - BPSK
m_fStrain = randsrc(s_nK,s_fTrainSize, v_fConst);
% Generate test symbols - BPSK
m_fStest = randsrc(s_nK,s_fTestSize, v_fConst);
% Training with noisy CSI
m_fRtrain = zeros(s_nN, s_fTrainSize);
for kk=1:s_fNumFrames
Idxs=((kk-1)*s_fFrameSize + 1):kk*s_fFrameSize;
m_fRtrain(:,Idxs) = (m_fH.*(1+ sqrt(s_fEstErrVar)*randn(size(m_fH))))*m_fStrain(:,Idxs);
end
for ii=1:length(v_fSNRdB)
s_fSigW = 10^(-0.1* v_fSNRdB(ii));
tic;
% Generate channel outputs
% Gaussian channel
m_fYtrain = m_fH * m_fStrain + sqrt(s_fSigW)*randn(s_nN, s_fTrainSize);
m_fYtrainErr = m_fRtrain + sqrt(s_fSigW)*randn(s_nN, s_fTrainSize);
m_fYtest = m_fH * m_fStest + sqrt(s_fSigW)*randn(s_nN, s_fTestSize);
% Soft PIC detector
if (v_nCurves(1) == 1)
% Initial guess - zeros
m_fInitial = zeros(size(m_fStest));
m_fBER(1,ii) = s_fSoftPIC(m_fYtest, m_fStest, m_fInitial, m_fH, (s_fSigW)*eye(s_nN), s_nIter);
end
% Soft PIC detector, uncertainty
if (v_nCurves(2) == 1)
for jj=1:s_fNumTestFrames
v_fIdxs = ((jj-1)*s_fFrameSize+1) : (jj*s_fFrameSize);
m_fBER(2,ii) = m_fBER(2,ii) + s_fSoftPIC(m_fYtest(:,v_fIdxs), m_fStest(:,v_fIdxs), ...
zeros(size(m_fStest(:,v_fIdxs))), ...
(m_fH.*(1+ sqrt(s_fEstErrVar)*randn(size(m_fH)))),...
(s_fSigW)*eye(s_nN), s_nIter);
end
% Average over noisy channel tests
m_fBER(2,ii) = m_fBER(2,ii)/s_fNumTestFrames;
end
% DeepSIC detector, sequential training
if (v_nCurves(3) == 1)
% Get network
v_cNet = GetDeepSICNet(m_fStrain,m_fYtrain, s_nIter);
% Apply network
m_fBER(3,ii) = s_fDetDeepSIC(m_fYtest, m_fStest, v_cNet, s_nIter);
end
% DeepSIC detector, sequential training, uncertainty
if (v_nCurves(4) == 1)
% Get network
v_cNet = GetDeepSICNet(m_fStrain, m_fYtrainErr, s_nIter);
% Apply network
m_fBER(4,ii) = s_fDetDeepSIC(m_fYtest, m_fStest, v_cNet, s_nIter);
end
toc;
ii
end
%% Display results
v_stPlotType = strvcat( '-rs', '--ro', '-b^', '--bv', '-k<', '-g<',...
'--k>','--g>', '-m*', '--mx', '-c^', '--cv');
v_stLegend = [];
fig1 = figure;
set(fig1, 'WindowStyle', 'docked');
%
for aa=1:s_nCurves
if (v_nCurves(aa) ~= 0)
v_stLegend = strvcat(v_stLegend, v_stPlots(aa,:));
semilogy(v_fSNRdB, m_fBER(aa,:), v_stPlotType(aa,:),'LineWidth',1,'MarkerSize',10);
hold on;
end
end
xlabel('SNR [dB]');
ylabel('BER');
grid on;
legend(v_stLegend,'Location','SouthWest');
hold off;