from BER of BPSK DS-SS System by Sanjeet Kumar
This shows the BER performance of BPSK DS-SS system in AWGN as well as fading channel.

ber_performance.m
%Find the bit error rate performance of BPSK DS-SS system over   
%(i)  AWGN  channel and 
%(ii) Slow Rayleigh fading channel corrupted by AWGN. Compare the performance with simple BPSK system.

clear all;
clc;
T=20;
snr=0:1:10;
snr2=0:1:10;
for i=1:length(snr)
    p(i)=awgn_per(snr(i),T);
end

for i=1:length(snr2)
    s(i)=fading_per(snr2(i),T);
end
semilogy(snr2,s,'b*-');

hold on;
semilogy(snr,p,'r*-');
xlabel('SNR')
ylabel('Probability Of Error')

Contact us at files@mathworks.com