⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stbc_2t2r_bpsk_uncorr_rayleigh.m

📁 2*1stbc coding 2*1stbc调制程序
💻 M
字号:
%SNR in dB;
%从译码上看出,两发两收最大比合并等于两发一收译码结果的呵,根据这个原理进行仿真;
function BER=stbc_2t2r_bpsk_uncorr_Rayleigh(SNR,SimBits)

%Generate source;
T1_InforSource=randint(1,SimBits/2,[0,1]);
T2_InforSource=randint(1,SimBits/2,[0,1]);

%BPSK modulation;
T1_InforSymbol=(T1_InforSource-0.5)*2;
T2_InforSymbol=(T2_InforSource-0.5)*2;

%STBC Tx2Rx2 encoding;
scale=sqrt(2);%total power of all transmitters are normalized to 1;
T1_STBC_Symbol=[T1_InforSymbol;-T2_InforSymbol]/scale;
T1_STBC_Symbol=reshape(T1_STBC_Symbol,1,SimBits);
T2_STBC_Symbol=[T2_InforSymbol;T1_InforSymbol]/scale;
T2_STBC_Symbol=reshape(T2_STBC_Symbol,1,SimBits);

%Independent Rayleigh fading channel; h is constant between adacent
%symbols;
h1=sqrt(0.5)*(randn(1,SimBits/2)+j*randn(1,SimBits/2));
h1=[h1;h1];
h1=reshape(h1,1,SimBits);
h2=sqrt(0.5)*(randn(1,SimBits/2)+j*randn(1,SimBits/2));
h2=[h2;h2];
h2=reshape(h2,1,SimBits);
h_1=[h1;h2];

h3=sqrt(0.5)*(randn(1,SimBits/2)+j*randn(1,SimBits/2));
h3=[h3;h3];
h3=reshape(h3,1,SimBits);
h4=sqrt(0.5)*(randn(1,SimBits/2)+j*randn(1,SimBits/2));
h4=[h4;h4];
h4=reshape(h4,1,SimBits);
h_2=[h3;h4];

noise_1=sqrt(10^(-SNR/10.0)/2)*(randn(1,SimBits)+j*randn(1,SimBits));
noise_2=sqrt(10^(-SNR/10.0)/2)*(randn(1,SimBits)+j*randn(1,SimBits));

%Received signals with STBC;
Received_Symbol_1=sum([T1_STBC_Symbol;T2_STBC_Symbol].*h_1,1)+noise_1;%Note: noise power is just added at the receiver;
Received_Symbol_2=sum([T1_STBC_Symbol;T2_STBC_Symbol].*h_2,1)+noise_2;%Note: noise power is just added at the receiver;

%STBC decoding;
h1_temp=reshape(h1,2,SimBits/2);
h2_temp=reshape(h2,2,SimBits/2);
h_1_temp=[h1_temp(1,:);h2_temp(1,:)];
h_1_temp=reshape(h_1_temp,1,SimBits);
[Combined_Signal_1_real,Combined_Signal_1_imag]=STBC_2t1r_Dec(real(h_1_temp),imag(h_1_temp),real(Received_Symbol_1),imag(Received_Symbol_1));

h3_temp=reshape(h3,2,SimBits/2);
h4_temp=reshape(h4,2,SimBits/2);
h_2_temp=[h3_temp(1,:);h4_temp(1,:)];
h_2_temp=reshape(h_2_temp,1,SimBits);
[Combined_Signal_2_real,Combined_Signal_2_imag]=STBC_2t1r_Dec(real(h_2_temp),imag(h_2_temp),real(Received_Symbol_2),imag(Received_Symbol_2));

Combined_Signal=Combined_Signal_1_real+j*Combined_Signal_1_imag+Combined_Signal_2_real+j*Combined_Signal_2_imag;
%for k=1:2:SimBits
%    Combined_Signal_temp(k)=conj(h(1,k))*Received_Symbol(1,k)+h(2,k)*conj(Received_Symbol(1,k+1));
%    Combined_Signal_temp(k+1)=conj(h(2,k))*Received_Symbol(1,k)-h(1,k)*conj(Received_Symbol(1,k+1));
%end
Combined_Signal=reshape(Combined_Signal,2,SimBits/2);

%BPSK demodulation;
T1_Sink=(sign(real(Combined_Signal(1,:)))+1)/2;
T2_Sink=(sign(real(Combined_Signal(2,:)))+1)/2;

%Error statistics;
BER=(length(find(T1_InforSource - T1_Sink))+length(find(T2_InforSource - T2_Sink)))/(SimBits);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -