📄 main.m
字号:
clear;
% parameters
times = 10000; % times OFDM symbols are simulated
fm = 200; % maxima Doppler frequency
d = 1; % time spread Tao_rms/T
M = 12; % number of multipaths
SNR_sim = []; % SNR in simulation
BER_OFDM = []; % BER of 1Tx + 1Rx
BER_ZF = []; % BER of SFBC Zero Force dectection
BER_DF = []; % BER of SFBC Decision Feedback dectection
BER_SML = []; % BER of SFBC Simple Maxima Likelihood dectection
BER_JML = []; % BER of SFBC Joint Maxima Likelihood dectection
BER_ZF_new = []; % BER of SFBC New Zero Force dectection
BER_DF_new = []; % BER of SFBC New Decision Feedback dectection
BER_SML_new = []; % BER of SFBC New Simple Maxima Likelihood dectection
BER_JML_new = []; % BER of SFBC New Joint Maxima Likelihood dectection
for SNR = 0:5:40
SNR
BPSK = 0; % Initialing
Others = [0 0 0 0 0 0 0 0]; % [ZF DF SML JML ZF_new DF_new SML_new JML_new]
for i = 1:times % run
temp = OFDMs(SNR, fm, d, M);
[temp1 temp2 temp3 temp4 temp5 temp6 temp7 temp8] = SFBCs(SNR, fm, d, M);
BPSK = BPSK + temp; % sum
Others = Others + [temp1 temp2 temp3 temp4 temp5 temp6 temp7 temp8];
end
% link
SNR_sim = [SNR_sim SNR ];
BER_OFDM = [BER_OFDM BPSK/times ];
BER_ZF = [BER_ZF Others(1)/times];
BER_DF = [BER_DF Others(2)/times];
BER_SML = [BER_SML Others(3)/times];
BER_JML = [BER_JML Others(4)/times];
BER_ZF_new = [BER_ZF_new Others(5)/times];
BER_DF_new = [BER_DF_new Others(6)/times];
BER_SML_new = [BER_SML_new Others(7)/times];
BER_JML_new = [BER_JML_new Others(8)/times];
end
% save data
save BER_DATA SNR_sim BER_ZF BER_DF BER_SML BER_JML ...
BER_OFDM BER_ZF_new BER_DF_new BER_SML_new BER_JML_new;
% plot BER
figure: semilogy(SNR_sim,BER_OFDM ,'c>', ...
SNR_sim,BER_JML ,'r>', SNR_sim,BER_SML ,'m>' , SNR_sim,BER_ZF ,'b>', SNR_sim,BER_DF ,'k>',...
SNR_sim,BER_JML_new,'rd', SNR_sim,BER_SML_new,'md', SNR_sim,BER_ZF_new,'bd', SNR_sim,BER_DF_new,'kd');
xlabel('Es/N0');ylabel('Bit Error Rate');
legend('1Tx + 1Rx', 'Con. ZF', 'Con. SML', 'Con. JML', 'Con. DF', 'NEW. ZF', 'NEW SML', 'NEW JML', 'Con. DF');
title('BER performance in BPSK - OFDM - SFBC(G2) system');
grid on;
saveas(gcf,'BER_BPSK_SFBC.fig');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -