% This program is reprogramed and tested by Zhang Jing, Shanghai Normal University,
% simulates the bit-error-rate (BER) performance of OSTBC,encoding rate 1/2
% with L=4 transmit antennas and R =2 receiver antenna with equal gain combination over the frequency flat Rayleigh block fading channel
% modulation- 16 QAM with gray coding resulting in 2 bits/sec/H
% this program is reference to the OSTBC program by Samat Shabdanov, February 2007
clc
%16 QAM constellation
x=[-3 -3 -3 -3 -1 -1 -1 -1 3 3 3 3 1 1 1 1 ];
y=[3 1 -3 -1 3 1 -3 -1 3 1 -3 -1 3 1 -3 -1 ];
Qam=x+y*i;
Es=5; %average constellation energy for d=2;
index=1;
%set SNR step
step=3;
% SNR range is here
for SNR=0:step:21
%number of bit errors set to zero
count=0;
%number of iterations
N=10^4;
if SNR==20 N=3*10^4; end; % increase for higher SNR
for it=1:N
%generate 16 bits uniformly distributed
A=round(rand(1,16));
% TX symbols
s1=Qam(bi2de(A(1:4),'left-msb')+1);
s2=Qam(bi2de(A(5:8),'left-msb')+1);
s3=Qam(bi2de(A(9:12),'left-msb')+1);
s4=Qam(bi2de(A(13:16),'left-msb')+1);
C1=[s1 s2 s3 s4; -s2 s1 -s4 s3; -s3 s4 s1 -s2; -s4 -s3 s2 s1];
C=[C1; conj(C1)];
%Channel coefficients
Z=0;
K1=1/sqrt(2)*(randn(4,1)+i*randn(4,1)); % normalize to the variance 1 CN(0,1)
K2=1/sqrt(2)*(randn(4,1)+i*randn(4,1)); % normalize to the variance 1 CN(0,1)
%AWGN channel
N0=(4*Es/10^(SNR/10));
Z1=sqrt(N0/2)*(randn(8,1)+i*randn(8,1)); % variance N0
Z2=sqrt(N0/2)*(randn(8,1)+i*randn(8,1)); % variance N0
%RX symbols
R1=C*K1+Z1;
R2=C*K2+Z2;
%decoding ML OSTBC
H1=[K1(1) K1(2) K1(3) K1(4); K1(2) -K1(1) K1(4) -K1(3); K1(3) -K1(4) -K1(1) K1(2); K1(4) K1(3) -K1(2) -K1(1)];
H2=[K2(1) K2(2) K2(3) K2(4); K2(2) -K2(1) K2(4) -K2(3); K2(3) -K2(4) -K2(1) K2(2); K2(4) K2(3) -K2(2) -K2(1)];
H1_1=[H1;conj(H1)];
H2_1=[H2;conj(H2)];
R1_1=[R1(1:4); conj(R1(5:8))];
R2_1=[R2(1:4); conj(R2(5:8))];
S1= H1_1'*R1_1/(2*sum(abs(K1).^2));
S2 = H2_1'*R2_1/(2*sum(abs(K2).^2));
S = 0.5*S1+0.5*S2;
%symbol decoding for 16-QAM
L=[abs(Qam-S(1)); abs(Qam-S(2)); abs(Qam-S(3)); abs(Qam-S(4))];
[D,I]=min(L,[],2);
%TX bits
dec_bits(1,1:4)=de2bi(I(1)-1,4,'left-msb');
dec_bits(1,5:8)=de2bi(I(2)-1,4,'left-msb');
dec_bits(1,9:12)=de2bi(I(3)-1,4,'left-msb');
dec_bits(1,13:16)=de2bi(I(4)-1,4,'left-msb');
%count errors
count=count+sum(abs(A-dec_bits));
end;
B_err(index)=count/(N*16)
index=index+1;
end;
semilogy(0:step:21, B_err);
hold on;
w4_zj_2.rar_等增益合并
版权申诉
159 浏览量
2022-09-24
04:23:33
上传
评论
收藏 1KB RAR 举报
JonSco
- 粉丝: 72
- 资源: 1万+
最新资源
- 基于matlab实现 powell算法 用matlab实现,使用方法内附详细说明.rar
- 基于matlab的手写字体识别程序,并对结果进行保存.rar
- 基于c语言指纹识别demo代码 包括了指纹图像方向图计算、频率计算、gabor滤波器增强,细化,特征点提取,特征点匹配.rar
- 基于c++NSGA-2思想的多目标优化程序,采用进化算法处理多目标实值优化问题.rar
- Linux系统中常用权限管理命令
- Coello Coello等人提出了MOPSO 该程序基于matlab实现针对测试函数matlab程序
- Linux系统中常用权限管理命令
- AIR-AP1815-K9-ME-8-5-182-0.tar For Cisco AP1815
- 实验七.zip
- ESP8266刷固件软件flash-download-tools-v3.6.5,AT固件,机智云固件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈