qpsk_system_ber_simulation.m

来自「对于QPSK性能分析的源码,最后给除2种信道下的误码率比较图」· M 代码 · 共 42 行

M
42
字号
% QPSK System Simulation, Pe evaluation
clear;
echo on
SNRindB1=0:1:6;
SNRindB2=0:0.1:6;
% rayleigh channel 
for i=1:length(SNRindB1),
    [pb,ps]=cm_sm32(SNRindB1(i));               % simulated bit and symbol error rates
    smld_bit_ray_err_prb(i)=pb;
    smld_symbol_ray_err_prb(i)=ps;
    disp([ps,pb]);
    echo off;
end;
% awgn channel 
echo on;
for i=1:length(SNRindB1),
    [pb1,ps1]=cm_sm33(SNRindB1(i));             
    smld_bit_awgn_err_prb(i)=pb1;
    smld_symbol_awgn_err_prb(i)=ps1;
    disp([ps1,pb1]);
    echo off;
end;
% theory curve
echo on;
for i=1:length(SNRindB2),
    SNR=exp(SNRindB2(i)*log(10)/10);                 % signal to noise ratio
    theo_err_awgn_prb(i)=0.5*erfc(sqrt(SNR));        % AWGN theoretical bit error rate
    theo_err_ray_prb(i)=0.5*(1-1/sqrt(1+1/SNR));     % Rayleigh theoretical bit error rate
    echo off;
end;
echo on;
% Plotting commands follow
semilogy(SNRindB2,theo_err_awgn_prb,'r'),title('BER curves');hold on;
semilogy(SNRindB1,smld_bit_awgn_err_prb,'r*');hold on;
semilogy(SNRindB2,theo_err_ray_prb);hold on;
semilogy(SNRindB1,smld_bit_ray_err_prb,'*');
xlabel('Eb/No');ylabel('BER');
legend('theory AWGN curve','simulated AWGN curve','theory Rayleigh curve','simulated Rayleigh curve');
echo off;


⌨️ 快捷键说明

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