GENERATING RAYLEIGH PSK VS AWGN PLOT (BER VS SNR)

GENERATING RAYLEIGH PSK VS AWGN PLOT (BER VS SNR)
331 descargas
Actualizado 14 may 2015

Ver licencia

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

Citar como

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. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2009b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre PHY Components en Help Center y MATLAB Answers.

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0