Generating Random Numbers. Mean, Variance, Standard Deviation Mean: –mean(x) Variance:...

download Generating Random Numbers. Mean, Variance, Standard Deviation Mean: –mean(x) Variance: –mean((x-mean(x).*(x-mean(x))) Standard Deviation –std(x)

of 21

  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    216
  • download

    1

Embed Size (px)

Transcript of Generating Random Numbers. Mean, Variance, Standard Deviation Mean: –mean(x) Variance:...

  • Slide 1
  • Generating Random Numbers
  • Slide 2
  • Mean, Variance, Standard Deviation Mean: mean(x) Variance: mean((x-mean(x).*(x-mean(x))) Standard Deviation std(x)
  • Slide 3
  • Correlation Coefficient Correlation coefficient function r = corco(x,y) mx = mean(x); my = mean(y); covxy = mean((x-mx).*(y-my)); r = covxy/(std(x)*std(y)); Or use Matlab function corrcoef
  • Slide 4
  • Random Numbers rand(M,N):MxN matrix of uniformly distributed random numbers on (0,1) randn(M,N)MxN matrix of normally distributed random numbers (=0, 2 =1) normrnd(m,s,M,N)MxN matrix of normally distributed random numbers (=m, =s) x=randn(1,10000); mean((x
  • Poisson function genpois(N,lambda) for i=1:N, k=0;p=1; u=rand; p=p*u; while p>=exp(-lambda) u=rand; p=p*u; k=k+1; end x(i)=k; end Or use Matlab function poissrnd(lambda,M,N)