communication systems simulation - iii harri saarnisaari
DESCRIPTION
Communication Systems Simulation - III Harri Saarnisaari Part of Simulations and Tools for Telecommunication Course. Random Number Generation. Many simulators include random number generators you can use those These should be validated If not already accepted by your community - PowerPoint PPT PresentationTRANSCRIPT
Communication Systems Simulation - III
Harri SaarnisaariPart of Simulations and Tools for Telecommunication
Course
2
Random Number Generation
• Many simulators include random number generators– you can use those
• These should be validated– If not already accepted by your community– But you always can questionnaire those,
especially new generators• Here we consider some aspects of validation
3
Random Number Generation
• Complex additive white Gaussian noise is usually met in communication simulations
• Used to model thermal noise• Properties:
– I and Q channels (real and imaginary part)– Zero mean– I and Q independent– White
• Flat power spectrum density (PSD)• Impulsive autocorrelation (impulse at zero flag)
– I and Q are Gaussian
4
RNG example
• We use MATLAB to do some tests• MATLAB has randn m-file that generates zero
mean, unit variance random variables• RNGs use an initial value (state, seed) from which
they start– This should be randomized
• In MATLAB (5) you may add command RANDN('state',sum(100*clock)) to your startup file to set the generator to a different state each time you start
5
RNG example
%create complex white Gaussian signal with N elementsN=10000;n=randn(N,1)+j*randn(N,1);
• Is it zero mean?%check meanMEAN=mean(n)plot([real(n) imag(n)])legend('real','imag')title('mean of real and imaginary part')
6
The larger N is the close zero the mean isN=1000, mean 0.0177 + 0.0263iN=10 000, mean 0.0044 - 0.0017i
However, if you repeat the trial several times andcalculate the average the result is zero.
7
RNG example
%check variance, should be 2 now since%we have a sum of two Gaussian processes with
var 1VAR=var(n)
– N=1000, VAR=1.9617– N=10 000, VAR=2.0292– The larger N is, the closer VAR is 2
8
RNG example
• I and Q independent, how it is measured?• Cross correlation should be zero• Cross correlation coefficient should be zero
%check independency of I and Q%since maximum is N (if fully correlated sequences%the result is scaled by Nplot(xcorr(real(n),imag(n))/N)%same is verified by calculating correlation coefficient,
where%results are normalized by standard deviationsXCORR=corrcoef(real(n),imag(n))
9
N=1000XCORR =
1.0000 -0.0600 -0.0600 1.0000
Correlation 6 %
N= 10 000XCORR =
1.0000 0.0296 0.0296 1.0000
Correlation 3 %
The larger N the Closer independency I and Q are
10
RNG example
• Whiteness?– Autocorrelation impulsive– PSD flat
%check whiteness, %maximum autocorrelation 2Nplot(abs(xcov(n)))title('autocorrelation')psd(n) %uses Welch methodtitle('PSD')
11
Quite impulsive
12Quite flat
13
RNG example
• Gaussianity?– Histogram– Statistical tests (not considered herein)
%check Gaussianityhist([real(n) imag(n)],50) %50 barslegend('real','imag')title('histograms')
14Quite Gaussian shapes
15
Fading channels
• To create fading channels you have to understand what they are
• In fading channels signal and possibly its delayed versions are multiplied by random (tap) coefficients
• Rayleigh fading channel– Taps are zero mean, complex Gaussian variables with a
variance set so that SNR is what is wanted– Equally, amplitude is Rayleigh distributed and phase is
uniformly distributed between 0 and 2
16
Fading channels
• Rician fading channels– Taps are non-zero mean complex Gaussian
variables with a variance and amplitude set so that SNR is what is wanted
– Alternatively, amplitude is Rician distributed and phase is uniformly distributed between 0 and 2
• Also other fading channels exist
17
Fading channels
• Changing mean and variance of a zero mean unit variance complex Gaussian variance x to m and 2
• Multiply by and add m, i.e., new x = x+m• In fading channels one is usually interested the amplitude
of the tap, not the phase– Create taps as rayleigh * exp(j*2*pi*rand)– Or rician * exp(j*2*pi*rand)– Some MATLAB toolboxes include generation of Rayleigh
and Rician variables, otherwise you may create them from two Gaussian variables