Simulation Example with Matlab

Topics: Rayleigh fading, Fading, Doppler effect Pages: 4 (1227 words) Published: March 18, 2013
%Part of Telecommunication simulations course, Spring 2006 %Harri Saarnisaari, CWC

%We simulate uncoded BER of BPSK modulated data as a function of SNR %-in an AWGN channel %-in a Rayleigh fading channel %-in an AWGN channel when direct sequence spreading is used

%and compare results to the theoretical ones.
%We assume coherent receiver and perfect synchronization. ------------------------------------------------%set used SNR values %SNR (Eb/No) values in decibels SNR=[0:2:14]'; %column vector %SNR in linear scale snr=10.^(SNR/10); ------------------------------------------------%we create initial zero vectors for BER BER1=zeros(length(SNR),1); BER2=BER1; BER3=BER1; -----------------------------------------------

%we need a DS-code, we create a random, complex one, length Nc %elements +-1 +- j*1 Nc=32; %note that all parameters are defined as variables %their change afterwards is easy %(no need to change it every place, just once) ds=(2*round(rand(Nc,1))-1)+j*(2*round(rand(Nc,1))1); %ds-code %plot the ds signal plot([real(ds) imag(ds)]), axis([0 Nc -1.1 1.1]) title('real and imaginary parts of DS code'), legend('real','imag'),pause -------------------------------------------------%we use symbol energy normalized to 1 %thus, DS energy is normalized to 1 (it is a pulse waveform) ds=ds/norm(ds); %check this ds_energy=norm(ds)^2,pause (NOTE: normalization is a usual trick) -------------------------------------------------%Monte Carlo loop starts here %some initial values %totally Nmax symbols Nmax=1000; %maximum number of iterations Nerr=100; %minimum number of errors for k=1:length(SNR), %we do MC trials for each SNR for l=1:Nmax, %MC loop


%DATA %we create data as vectors of length Ns symbols %and thus use MATLAB's vector processing capabilities %in addition to for loops (since too long vectors are problems %to some versions of MATLAB) Ns=100; data=2*round(rand(Ns,1))-1; %data is random and...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • MM1 simulation in Matlab Essay
  • System Simulation in Matlab/Simulink Essay
  • Simulation Report Essay
  • Essay about simulation
  • Simulation Essay
  • simulation Essay
  • Matlab Essay
  • MATLAB Essay

Become a StudyMode Member

Sign Up - It's Free