基于Alamouti 空间时间分组编码模拟瑞利衰落信道 BPSK 调制并计算误码率附matlab完整代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法  神经网络预测 雷达通信  无线传感器

信号处理 图像处理 路径规划 元胞自动机 无人机  电力系统

⛄ 内容介绍

基于Alamouti提出的BPSK调制下空时分组码在Rayleigh衰落信道中的码性能原理,推导出高阶(M ary)调制下Rician衰落信道中空时分组码的符号差错率的最小距离球界,并进行计算机仿真分析了两信道下引入空时分组码的多天线系统中发射和接收天线的分集增益,发射天线数量的"地板效应"以及Rician因子K对符号差错性能的影响。

⛄ 完整代码

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% from Krishna Pillai.

%使用 Alamouti 空间时间分组编码以百分比瑞利衰落信道计算 BPSK 调制误码率的脚本

% Script for computing the BER for BPSK modulation in a

% Rayleigh fading channel with Alamouti Space Time Block Coding

% Two transmit antenna, 1 Receive antenna

clear

N = 10^6; % number of bits or symbols

Eb_N0_dB = [0:25]; % multiple Eb/N0 values

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

    % Alamouti STBC 

    sCode = zeros(2,N);

    sCode(:,1:2:end) = (1/sqrt(2))*reshape(s,2,N/2); % [x1 x2  ...]

    sCode(:,2:2:end) = (1/sqrt(2))*(kron(ones(1,N/2),[-1;1]).*flipud(reshape(conj(s),2,N/2))); % [-x2* x1* ....]

    h = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % Rayleigh channel

    hMod = kron(reshape(h,2,N/2),ones(1,2)); % repeating the same channel for two symbols    

    n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise, 0dB variance

    % Channel and noise Noise addition

    y = sum(hMod.*sCode,1) + 10^(-Eb_N0_dB(ii)/20)*n;

    % Receiver

    yMod = kron(reshape(y,2,N/2),ones(1,2)); % [y1 y1 ... ; y2 y2 ...]

    yMod(2,:) = conj(yMod(2,:)); % [y1 y1 ... ; y2* y2*...]

    % forming the equalization matrix

    hEq = zeros(2,N);

    hEq(:,[1:2:end]) = reshape(h,2,N/2); % [h1 0 ... ; h2 0...]

    hEq(:,[2:2:end]) = kron(ones(1,N/2),[1;-1]).*flipud(reshape(h,2,N/2)); % [h1 h2 ... ; h2 -h1 ...]

    hEq(1,:) = conj(hEq(1,:)); %  [h1* h2* ... ; h2 -h1 .... ]

    hEqPower = sum(hEq.*conj(hEq),1);

    yHat = sum(hEq.*yMod,1)./hEqPower; % [h1*y1 + h2y2*, h2*y1 -h1y2*, ... ]

    yHat(2:2:end) = conj(yHat(2:2:end));

    % 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)); 

pAlamouti = 1/2 - 1/2*(1+2./EbN0Lin).^(-1/2);

theoryBerAlamouti_nTx2_nRx1 = pAlamouti.^2.*(1+2*(1-pAlamouti)); 

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,theoryBerAlamouti_nTx2_nRx1,'c+-','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)', 'theory (nTx=2, nRx=1, Alamouti)', 'sim (nTx=2, nRx=1, Alamouti)');

xlabel('Eb/No, dB');

ylabel('Bit Error Rate');

title('BER for BPSK modulation with Alamouti STBC (Rayleigh channel)');

⛄ 运行结果

⛄ 参考文献

[1]张薇. 无线移动通信中空时分组编码的性能分析[D]. 兰州大学.

⛄ 完整代码

❤️部分理论引用网络文献,若有侵权联系博主删除

❤️ 关注我领取海量matlab电子书和数学建模资料

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值