%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The file may not be re-distributed without explicit authorization
% Checked for proper operation with Octave Version 3.0.0
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Script for computing the BER for BPSK modulation in a
% Rayleigh fading channel with 2 Tx, 2Rx MIMO channel
% Zero Forcing equalization
clear
N = 10^6; % number of bits or symbols
Eb_N0_dB = [0:25]; % multiple Eb/N0 values
nTx = 2;
nRx = 2;
for ii = 1:length(Eb_N0_dB)
% Transmitter
ip = rand(1,N)>0.5; % generating 0,1 with equal probability
s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0
sMod = kron(s,ones(nRx,1)); %
sMod = reshape(sMod,[nRx,nTx,N/nTx]); % grouping in [nRx,nTx,N/NTx ] matrix
h = 1/sqrt(2)*[randn(nRx,nTx,N/nTx) + j*randn(nRx,nTx,N/nTx)]; % Rayleigh channel
n = 1/sqrt(2)*[randn(nRx,N/nTx) + j*randn(nRx,N/nTx)]; % white gaussian noise, 0dB variance
% Channel and noise Noise addition
y = squeeze(sum(h.*sMod,2)) + 10^(-Eb_N0_dB(ii)/20)*n;
% Receiver
% Forming the Zero Forcing equalization matrix W = inv(H^H*H)*H^H
% H^H*H is of dimension [nTx x nTx]. In this case [2 x 2]
% Inverse of a [2x2] matrix [a b; c d] = 1/(ad-bc)[d -b;-c a]
hCof = zeros(2,2,N/nTx) ;
hCof(1,1,:) = sum(h(:,2,:).*conj(h(:,2,:)),1); % d term
hCof(2,2,:) = sum(h(:,1,:).*conj(h(:,1,:)),1); % a term
hCof(2,1,:) = -sum(h(:,2,:).*conj(h(:,1,:)),1); % c term
hCof(1,2,:) = -sum(h(:,1,:).*conj(h(:,2,:)),1); % b term
hDen = ((hCof(1,1,:).*hCof(2,2,:)) - (hCof(1,2,:).*hCof(2,1,:))); % ad-bc term
hDen = reshape(kron(reshape(hDen,1,N/nTx),ones(2,2)),2,2,N/nTx); % formatting for division
hInv = hCof./hDen; % inv(H^H*H)
hMod = reshape(conj(h),nRx,N); % H^H operation
yMod = kron(y,ones(1,2)); % formatting the received symbol for equalization
yMod = sum(hMod.*yMod,1); % H^H * y
yMod = kron(reshape(yMod,2,N/nTx),ones(1,2)); % formatting
yHat = sum(reshape(hInv,2,N).*yMod,1); % inv(H^H*H)*H^H*y
% receiver - hard decision decoding
ipHat = real(yHat)>0;
% counting the errors
nErr(ii) = size(find([ip- ipHat]),2);
end
simBer = nErr/N; % simulated ber
EbN0Lin = 10.^(Eb_N0_dB/10);
theoryBer_nRx1 = 0.5.*(1-1*(1+1./EbN0Lin).^(-0.5));
p = 1/2 - 1/2*(1+1./EbN0Lin).^(-1/2);
theoryBerMRC_nRx2 = p.^2.*(1+2*(1-p));
close all
figure
semilogy(Eb_N0_dB,theoryBer_nRx1,'bp-','LineWidth',2);
hold on
semilogy(Eb_N0_dB,theoryBerMRC_nRx2,'kd-','LineWidth',2);
semilogy(Eb_N0_dB,simBer,'mo-','LineWidth',2);
axis([0 25 10^-5 0.5])
grid on
legend('theory (nTx=1,nRx=1)', 'theory (nTx=1,nRx=2, MRC)', 'sim (nTx=2, nRx=2, ZF)');
xlabel('Average Eb/No,dB');
ylabel('误码率');
title('2x2 MIMO 和 ZF 均衡器(瑞利信道) BPSK 调制的误码率');


海神之光
- 粉丝: 5w+
- 资源: 7136
最新资源
- APA水平泊车算法与车辆实时控制:Matlab与C++联合仿真路径规划与跟踪算法研究,APA泊车算法详解:Matlab与C++联合仿真实现路径规划与车辆控制,APA水平泊车算法,matlab和C++联
- 学生选课-安卓-基于android的学生选课系统设计与实现
- 基于Matlab的无线充电仿真研究:四套模型解析-LLC谐振恒压输出、LCC-S拓扑磁耦合谐振恒压输出、LCC-P拓扑磁耦合谐振恒流输出及S-S拓扑补偿模型探究,基于Matlab的无线充电仿真研究:
- 基于S7-200 PLC与组态王技术的多维度分拣系统:大小、颜色、材质与形状的智能识别与处理No.883,基于S7-200 PLC与组态王控制的大小球颜色材质分拣系统技术实现与优化研究(No.883)
- 垃圾分类-WeChat-基于微信小程序的垃圾分类设计与实现(毕业论文)
- Screenshot_20250219_200245.jpg
- S7-200 PLC在变电站变压器自动化中的高级应用:No.1219案例分析,S7-200 PLC在变电站变压器自动化中的关键应用:No.1219的实践与探索,No.1219 S7-200 PLC在变
- 基于LQR控制算法的四轮独立电驱车辆横向稳定性控制研究:双移线工况仿真与PID及无控车辆对比,基于LQR控制算法的四轮独立电驱汽车横向稳定性控制研究:双移线工况仿真与PID及无控车辆对比,适用方向:基
- 基于银河麒麟桌面&服务器操作系统的DeepSeek本地化部署方法.pdf
- 电子科技大学毕设设计论文LaTeX模板-UESTCthesis
- 零担物流智慧管理-WeChat-基于微信小程序的零担物流智慧管理平台设计(毕业论文)
- 基于高温流变与热加工过程的材料本构模型研究-真应力-真应变关系、本构方程参数拟合与动态再结晶行为的探究,材料热加工工艺中的真应力-应变分析与本构模型构建-探究高温流变特性及功率耗散因子计算,高温流
- 新版骆驼IPTV小肥米iptv管理系统全开源源码可对接EZtv电视直播管理系统.zip
- https://upload.csdn.net/creation/uploadResources?spm=1011.2124.3001.5646
- 云开发高效学习微信小程序源码共享平台.zip
- 基于Simulink的模块化多电平变换器MMC仿真解析:从交流380V到直流800V的整流过程,附搭建指南、原理出处与PCB电路设计实践,模块化多电平变换器MMC仿真详解:从原理到实践,电力电子交直流
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


