📄 test.m
字号:
% Type of different detectors, parameters for Detector.m
ML = 1;
JMMSE = 2;
ZF = 3;
% Type of different antenna selection criteria methods
MBER = 1;
MMI = 2;
LAZY = 3;
MNP = 4;
MMNP = 5;
LAZY2 = 6;
BER=zeros(6,1);
real_ch = 0; % real_ch = 0 refers to simulated channel in MATLAB,
nr_frames = 20; % number of frames sent when simulation.
sigma = 10^(-10);% avoid log 0
tx(nr_frames);
i= 1;
for SNR= 12:2:26
disp(['Eb/No = ', num2str(SNR-6)]);
EbN0(i) = SNR -6;
RF(0,SNR);
disp('ZF');
tic
BER(1,i) = rx(ZF,MMNP);
BER(2,i) = rx(ZF,MBER);
BER(3,i) = rx(ML,MMNP);
BER(4,i) = rx(ML,MBER);
BER(5,i) = rx(JMMSE,MMNP);
BER(6,i) = rx(JMMSE,MBER);
toc
save('BER_EbN0_100_2','BER','EbN0');
% BER(5,i) = rx(ML,MMNP);
% disp('ML');
% tic
% BER(1,i) = rx(ML,MBER);
% toc
% % disp('JMMSE');
% % tic
% % BER(2,i) = rx(JMMSE,MBER);
% % toc
% BER(6,i) = rx(ZF,MNP);
% BER(4,i) = rx(ML,MNP);
% BER(5,i) = rx(JMMSE,MMI);
i=i+1;
end
% figure;
% subplot(1,2,1)
% plot(BER(1,:),'r.');
% hold on;
% plot(BER(2,:),'b.');
% hold on;
% plot(BER(3,:),'k.');
% title('BER vs. Eb/N0 with different Detectors and MBER');
% legend('ML','JMMSE','ZF');
%
% subplot(1,2,2)
% plot(BER(1,:),'r.');
% hold on;
% plot(BER(4,:),'r-.');
% title('BER vs. Eb/N0 with different selection method and ML');
% legend('MBER','MMI');
figure;
semilogy(EbN0,BER(1,:)+sigma,'r+-');
hold on;
semilogy(EbN0,BER(2,:)+sigma,'r-.');
hold on;
semilogy(EbN0,BER(3,:)+sigma,'k+-');
hold on;
semilogy(EbN0,BER(4,:)+sigma,'k-.');
hold on;
semilogy(EbN0,BER(5,:)+sigma,'b+-');
hold on;
semilogy(EbN0,BER(6,:)+sigma,'b-.');
title('BER vs. Eb/N0 with different Detectors and selection');
%legend('ML MBER','ML MMI','JMMSE MBER','JMMSE MMI','ZF MBER','ZF MMI');
legend('ZF MMNP','ZF MBER','ML MMNP','ML MBER','JMMSE MMNP','JMMSE MBER');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -