0
点赞
收藏
分享

微信扫一扫

基于Alamouti 空间时间分组编码模拟瑞利衰落信道 BPSK 调制并计算误码率附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)');

⛄ 运行结果

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

⛄ 参考文献

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

⛄ 完整代码

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料


举报

相关推荐

0 条评论