GENERATING RAYLEIGH PSK VS AWGN PLOT (BER VS SNR)

버전 1.0.0.0 (1.61 KB) 작성자: raghav khandelwal
GENERATING RAYLEIGH PSK VS AWGN PLOT (BER VS SNR)
다운로드 수: 331
업데이트 날짜: 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