资源简介
本程序是通过生成码本和采用OSTBC的ALAMOUTI预编码来获得需要的BER,所得到的的BER随着SNR的值增大而变化。该程序能够实现良好的性能特点
代码片段和文件信息
% Alamouti_2x1_precoding.m
%MIMO-OFDM Wireless Communications with MATLAB㈢ Yong Soo Cho Jaekwon Kim Won Young Yang and Chung G. Kang
%2010 John Wiley & Sons (Asia) Pte Ltd
clear all; clf
%%%%%% Parameter Setting %%%%%%%%%
N_frame=1000; N_packet=100;
b=2; M=2^b;
mod_obj=modem.qammod(‘M‘M‘SymbolOrder‘‘Gray‘‘InputType‘‘bit‘);
demod_obj = modem.qamdemod(mod_obj);
% MIMO Parameters
T_TX=4; code_length=64;
NT=2; NR=1; % Numbers of transmit/receive antennas
N_pbits=NT*b*N_frame; N_tbits=N_pbits*N_packet;
code_book = codebook_gen;
fprintf(‘====================================================\n‘);
fprintf(‘ Precoding transmission‘);
fprintf(‘\n %d x %d MIMO\n %d QAM‘ NTNRM);
fprintf(‘\n Simulation bits : %d‘ N_tbits);
fprintf(‘\n====================================================\n‘);
SNRdBs = [0:2:10]; sq2=sqrt(2);
for i_SNR=1:length(SNRdBs)
SNRdB = SNRdBs(i_SNR);
noise_var = NT*0.5*10^(-SNRdB/10); sigma = sqrt(noise_var);
rand(‘seed‘1); randn(‘seed‘1); N_ebits=0;
for i_packet=1:N_packet
msg_bit = randint(N_pbits1); % Bit generation
%%%%%%%%%%%%% Transmitter %%%%%%%%%%%%%%%%%%
s = modulate(mod_objmsg_bit);
Scale = modnorm(s‘avpow‘1); % Normalization
S = reshape(Scale*sNT1N_frame); % Transmit symbol
Tx_symbol = [S(11:) -conj(S(21:)); S(21:) conj(S(11:))];
%%%%%%%%%%%%% Channel and Noise %%%%%%%%%%%%%
H = (randn(NRT_TX)+j*randn(NRT_TX))/sq2;
for i=1:code_length
cal(i) = norm(H*code_book(::i)‘fro‘);
end
[valIndex] = max(cal);
He = H*code_book(::Index);
norm_H2 = norm(He)^2; % H selected and its norm2
for i=1:N_frame
Rx(::i) = He*Tx_symbol(::i)+sigma*(randn(NR2)+j*randn(NR2));
end
%%%%%%%%%%%%% Receiver %%%%%%%%%%%%%%%%%%
for i=1:N_frame
y(1i) = (He(1)‘*Rx(:1i)+He(2)*Rx(:2i)‘)/norm_H2;
y(2i) = (He(2)‘*Rx(:1i)-He(1)*Rx(:2i)‘)/norm_H2;
end
S_hat = reshape(y/ScaleNT*N_frame1);
msg_hat = demodulate(demod_objS_hat);
N_ebits = N_ebits + sum(msg_hat~=msg_bit);
end
BER(i_SNR) = N_ebits/N_tbits;
end
semilogy(SNRdBsBER‘-k^‘ ‘LineWidth‘2); hold on; grid on;
xlabel(‘SNR[dB]‘) ylabel(‘BER‘); legend(‘Precoded Alamouti‘);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2391 2017-07-05 16:48 codebook_generator\Alamouti_2x1_precoding.m
文件 595 2017-07-05 16:48 codebook_generator\codebook_generator.m
目录 0 2018-05-02 21:42 codebook_generator\
- 上一篇:lm317可调稳压电源
- 下一篇:交通灯的汇编语言源代码程序
评论
共有 条评论