SLIDE 6 6
11 EE6882-Chang
Generate Samples Of Gaussian
function) (error 2 ) ( , 2 1 2 1 2 1 ) ( ) ( 2 1 ) ( 1 , ), 1 , | ( ~
2 1 2
2 2
∫ ∫
− ∞ − −
= + = = = → = =
x t x x
dt e x erf where x erf dt t p x F e x p x N x π π σ µ
Step 1: Generate uniform samples
u F uniform u
u =
), 1 , ( ~
Step 2:
( ) ( ) ( )
) 1 2 ( 2 1 2 1 2 1
1
− = = → + = = =
−
u erfinv u F x x erf x F u u F
X X U
Step 3: Generate
2
2 1 1 : 1
2 1 ) ( ) , | ( ~
d
x D d D D
e x p I x N x
− =
Π = π
Step 4: Scale & shift
( )
Σ + Σ = , ~
2 / 1
µ µ N x z
See GauNorm demo 12 EE6882-Chang
Random Generators In Matlab
Generate normally distributed samples. 1-D Other similar generators include Betarnd, binornd, chi2rnd, exprnd, evrnd, frnd, gamrnd, geornd, hygernd, iwishrnd, lognrnd, nbinrnd, ncfrnd, nctrnd, ncx2rnd, normrnd, poissrnd, raylrnd, trnd, unidrnd, unifrnd, wblrnd, wblrnd, wishrnd normrnd Generate multivariate normally distributed samples. A similar generator is mvtrnd, which creates multivariate t distribution. mvnrnd A function to generate samples with specified distribution, 1-D random Create samples with standard normal distribution, N(0, 1), 1-D randn Generate uniformly distributed samples in the interval [0,1], 1-D rand Purpose Function Name
NOTE: All of these generators, except rand and randn, are included in Statistical Toolbox.
See ‘randtool’ and ‘disttool’ demos in Matlab