GENERATING RAYLEIGH PSK VS AWGN PLOT (BER VS SNR)

GENERATING RAYLEIGH PSK VS AWGN PLOT (BER VS SNR)
331.0 次下载
更新时间 2015/5/14

查看许可证

clc;
clear all;
close all;
N = 10^3; % number of bits

% Transmitter

a = rand(1,N)>0.5; % generating bits 0 and 1

s = 2*a-1; % numbers will be as 0 -> -1; 1 -> 0


SNRdB = 5:2:35; % multiple Eb/N0 values

for u = 1:length(SNRdB)

n = 1/sqrt(2)*(randn(1,N) + 1i*randn(1,N)); % AWGN
h = 1/sqrt(2)*(randn(1,N) + 1i*randn(1,N)); % rayleigh noise

% reciever
r = h.*s + 10^(-SNRdB(u)/20)*n;


ra = r./h;

% demodulation
b = real(ra)>0;

% errors
Err(u) = size(find([a- b]),2);

end

sBer = Err/N; % simulated ber of RAyleigh

% theoretical BER of AWGN channel
tBer_QAM = (1/4)*3*1/2*erfc(sqrt(4*0.05*(10.^(SNRdB/10)))); % theoretical ber of QAM
tBer_qpsk = 0.5*erfc(sqrt(10.^(SNRdB/10))); %theoretical ber of QPSK
tBer_psk =(1/3)*erfc(sqrt(3*10.^(SNRdB/10))*sin(pi/8)); %theoretical ber of PSK
tBer_bpsk = 0.5*erfc(sqrt(10.^(SNRdB/10))); %theoretical ber of BPSK

SNR = 10.^(SNRdB/10);

tBer = 0.5.*(1-sqrt(SNR./(SNR+1))); %theoretical ber for rayleigh

% plot
close all
figure
semilogy(SNRdB,tBer_QAM,'yd-','linewidth',3);
hold on
semilogy(SNRdB,tBer_qpsk,'k-','LineWidth',4);
hold on
semilogy(SNRdB,tBer_psk,'p-','LineWidth',2);
hold on
semilogy(SNRdB,tBer_bpsk,'r-','LineWidth',2);
hold on
semilogy(SNRdB,tBer,'bp-');
hold on
semilogy(SNRdB,sBer,'gs-');
grid on
legend('Theoretical QAM','Theoretical QPSK','Theoretical 8-PSK','Theoretical BPSK','Rayleigh Theoretical', 'Rayleigh Simulation');
xlabel('SNRdB');
ylabel('BER');
title('BER vs SNR(psk and qam and RAyleigh comaprison)');

引用格式

raghav khandelwal (2024). GENERATING RAYLEIGH PSK VS AWGN PLOT (BER VS SNR) (https://www.mathworks.com/matlabcentral/fileexchange/50852-generating-rayleigh-psk-vs-awgn-plot-ber-vs-snr), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2009b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 PHY Components 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0