% plot_PeRayleigh - plot symbol error rate for Rayleigh channels 

%% initialize
SNRdB = 0:0.1:10;
SNR = dB2lin(SNRdB);

Pe  = Q( sqrt( 2*SNR ) );              % AWGN
PeR = 0.5*(1-sqrt(SNR./(1+SNR)));       % Rayleigh

%% plot
semilogy(SNRdB, PeR, SNRdB, Pe)
xlabel( 'E_s/N_0 (dB)')
ylabel( 'Symbol Error Rate')
grid
legend('Rayleigh','AWGN')

%% Store name of script for automated figure generation
ScriptName = mfilename;
