forked from Trenson/MIMO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MetricSERZF.m
72 lines (66 loc) · 1.55 KB
/
MetricSERZF.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
clear; close all; clc;
K=20;
M=400;
N=1000;
SER=zeros(4,10);
m=1;
t=10; %公式23求均值的循环次数
s=1;
for SNR=-20:1:-11
temp=0;
for h=1:t
[p,px]=GenPNoQ(SNR,K,M,N,5);
temp=temp+px(1)*(p(2)+p(3)+p(4))+px(2)*(p(5)+p(7)+p(8))+px(3)*(p(9)+p(10)+p(12))+px(4)*(p(13)+p(14)+p(15));
end
SER(m,s)=temp/t;
s=s+1;
end
m=m+1;
s=1;
for SNR=-20:1:-11
temp=0;
for h=1:t
[p,px]=GenP(SNR,K,M,N,5);
temp=temp+px(1)*(p(2)+p(3)+p(4))+px(2)*(p(5)+p(7)+p(8))+px(3)*(p(9)+p(10)+p(12))+px(4)*(p(13)+p(14)+p(15));
end
SER(m,s)=temp/t;
s=s+1;
end
m=m+1;
s=1;
for SNR=-20:1:-11
temp=0;
for h=1:t
[p,px]=GenPNoQ(SNR,K,M,N,3);
temp=temp+px(1)*(p(2)+p(3)+p(4))+px(2)*(p(5)+p(7)+p(8))+px(3)*(p(9)+p(10)+p(12))+px(4)*(p(13)+p(14)+p(15));
end
SER(m,s)=temp/t;
s=s+1;
end
m=m+1;
s=1;
for SNR=-20:1:-11
temp=0;
for h=1:t
[p,px]=GenP(SNR,K,M,N,3);
temp=temp+px(1)*(p(2)+p(3)+p(4))+px(2)*(p(5)+p(7)+p(8))+px(3)*(p(9)+p(10)+p(12))+px(4)*(p(13)+p(14)+p(15));
end
SER(m,s)=temp/t;
s=s+1;
end
%画图程序
hf = figure;
set( hf, 'color', 'white');
SNR=-20:1:-11;
semilogy( SNR, SER(1,:), '-rs','LineWidth',1.5);
hold on;
semilogy( SNR, SER(2,:), '--rs','LineWidth',1.5);
hold on;
semilogy( SNR, SER(3,:), '-bo','LineWidth',1.5);
hold on;
semilogy( SNR, SER(4,:), '--bo','LineWidth',1.5);
set(hf,'position',[0,0,760,468])
grid on;
legend('Full CSI,no quantizer','Full CSI,quantizer','Channel estimation,no quantizer','Channel estimation,quantizer')
xlabel('\fontsize{14}SNR(dB)');
ylabel('\fontsize{14}SER per user');