-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparamimo_PN.m
182 lines (151 loc) · 4.79 KB
/
paramimo_PN.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
% Wireless Receivers II - Assignment 1:
%
% AWGN Spread Spectrum Multipath Parameter File
%
% Telecommunications Circuits Laboratory
% EPFL
% Parameters
P=[];
P.NumberOfBits = 184;
P.CodingType = 'None';
P.Modulation = 1; % 1: BPSK
P.codeLength = 8; % encoding (K=1+P.codeLength = 8)
P.codeRate = 1/2; % convolutional coding rate
P.encoderPolynominal = [753 561];
P.hadamardLength = 64;
P.ChannelType = 'Multipath'; % 'AWGN', 'Fading'
P.ChannelLength = 4;
P.NumberOfFrames = 5e3;
P.nMIMO = 2; %2 antennas
P.useIS95Walsh = 0; %boolean, 1 if the standard Walsh mapping is used as
% defined in the IS95 standard. 0 if
% orthogonalMIMO(De)modulation function is used.
P.nUsers = 64; % Number of users
for i_user = 1:P.nUsers
ESN = randi([0 1],1, 32);
P.Long_code(:,i_user) = gen_long_code(ESN,P); %PN sequence. Specific to each USER, but the SAME for both mimo
end
P.SNRRange = -35:2:5; % SNR Range to simulate in dB
P.ReceiverType = 'Rake';
P.RakeFingers = 4;
u=[ 32];
r=[ 3 ];
% for i_rakefingers=1:length(r)
% i_rakefingers
% simlab=[];
% for i_nuser=1:length(u)
% i_nuser
% P.nUsers = u(i_nuser);
% P.ChannelLength = r(i_rakefingers);
% P.RakeFingers = r(i_rakefingers);
%
% BERmimo(i_nuser,:,i_rakefingers) = simulatorMIMO(P);
%
% % if(u(i_nuser)>9)
% simlab{i_nuser} = sprintf('%s - Length: %d - Users: %d' ,P.ChannelType,P.ChannelLength,P.nUsers);
% % else
% % simlab(i_nuser,:) = sprintf('%s - Length: %d - Users: %d' ,P.ChannelType,P.ChannelLength,P.nUsers);
% % end
% end
%
% figure
% semilogy(P.SNRRange,BERmimo(:,:,i_rakefingers),'*-')
%
% xlabel('SNR','FontSize',12,'FontWeight','bold');
% ylabel('BER','FontSize',12,'FontWeight','bold');
% xlim([min(P.SNRRange) max(P.SNRRange)]);
% ylim([1e-6, 1e0]);
% title('MIMO IS95 simulation with zero-forcing')
% grid minor;
% legend(simlab);
%
% end
%
% BERmimo
%
% % =============================================================== SVD
% for i_rakefingers=1:length(r)
% i_rakefingers
% simlab=[];
% for i_nuser=1:length(u)
% i_nuser
% P.nUsers = u(i_nuser);
% P.ChannelLength = r(i_rakefingers);
% P.RakeFingers = r(i_rakefingers);
%
% BERsvd(i_nuser,:,i_rakefingers) = simulatorMIMOsvd(P);
%
% % if(u(i_nuser)>9)
% simlab{i_nuser} = sprintf('%s - Length: %d - Users: %d' ,P.ChannelType,P.ChannelLength,P.nUsers);
% % else
% % simlab(i_nuser,:) = sprintf('%s - Length: %d - Users: %d' ,P.ChannelType,P.ChannelLength,P.nUsers);
% % end
% end
%
% figure
% semilogy(P.SNRRange,BERsvd(:,:,i_rakefingers),'*-')
%
% xlabel('SNR','FontSize',12,'FontWeight','bold');
% ylabel('BER','FontSize',12,'FontWeight','bold');
% xlim([min(P.SNRRange) max(P.SNRRange)]);
% ylim([1e-6, 1e0]);
% title('MIMO IS95 simulation with singular value decomposition')
% grid minor;
% legend(simlab);
%
% end
%
% BERsvd
% =====================================================================
% for i_rakefingers=1:length(r)
% i_rakefingers
% simlab=[];
% for i_nuser=1:length(u)
% i_nuser
% P.nUsers = u(i_nuser);
% P.ChannelLength = r(i_rakefingers);
% P.RakeFingers = r(i_rakefingers);
%
% BERmmsenew(i_nuser,:,i_rakefingers) = simulatorMIMOmmse(P);
%
% simlab{i_nuser} = sprintf('%s - Length: %d - Users: %d' ,P.ChannelType,P.ChannelLength,P.nUsers);
% end
%
% figure
% semilogy(P.SNRRange,BERmmsenew(:,:,i_rakefingers),'*-')
%
% xlabel('SNR','FontSize',12,'FontWeight','bold');
% ylabel('BER','FontSize',12,'FontWeight','bold');
% xlim([min(P.SNRRange) max(P.SNRRange)]);
% ylim([1e-6, 1e0]);
% title('MIMO IS95 simulation with MMSE')
% grid minor;
% legend(simlab);
%
% end
%
% BERmmsenew
%
% save('sim10e5')
P.nUsers = 32;
P.ChannelLength = 3;
P.RakeFingers = 3;
BERbarker(1,:) = simulatorMIMO(P);
simlab{1} = sprintf('Long code, different for every user');
BERbarker(2,:) = simulatorMIMOtest(P);
simlab{2} = sprintf('Long code, same for every user');
P.Long_code(:,1) = genbarker(length(P.Long_code));
BERbarker(3,:) = simulatorMIMOtest(P);
simlab{3} = sprintf('Barker code, same for every user');
figure
semilogy(P.SNRRange,BERbarker,'*-')
xlabel('SNR','FontSize',12,'FontWeight','bold');
ylabel('BER','FontSize',12,'FontWeight','bold');
xlim([min(P.SNRRange) max(P.SNRRange)]);
ylim([1e-6, 1e0]);
title('MIMO IS95 simulation with zero-forcing. Users = 32, channel length = 3, rake fingers = 3')
grid minor;
legend(simlab);
hold on
BERbarker
save('sim10e5')