{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Microsoft PowerPoint - Introduction to Matlab3

Microsoft PowerPoint - Introduction to Matlab3 - MATLAB...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
MATLAB MATLAB PART PART 3 PREPARED BY PREPARED BY S. M. S. M. S. M. RAFIGH RAFIGH 2011 COURSE BY : PROF. COURSE BY : PROF. HOSSEINI HOSSEINI
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Binomial Distribution k=0:20; y=binopdf(k,20,0.5); ( ) (1 ) , 0,1,..., k n k n p k p p k n k  = =  2 (1 ) np np p μ σ = = − Bernoulli 1720 k=0:20; y=binocdf(k,20,0.5); stairs(k,y) stem(k,y) 20 0.5 n p = = grid on
Image of page 2
Binomial Distribution function y=mybinomial(n,p) for k=0:n y(k+1)=factorial(n)/(factorial(k)*factorial(n-k))*p^k*(1-p)^(n-k) end k=0:20; k=0:20; y=binopdf(k,20,0.1); y=mybinomial(20,0.5); stem(k,y) stem(k,y) 20 0.5 n p = = 20 0.1 n p = =
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Geometric Distribution k=0:20; y=geopdf(k,0.5); 1 ( ) (1 ) , 1,2,... k p k p p k = − = 2 2 1 1 p p p μ σ = = k=0:20; y=geocdf(k,0.5); stairs(k,y) ( ) (1 ) , 0,1,2,... k p k p p k = − = Warning: Matlab assumes stem(k,y) 0.5 p = axis([0 20 0 1])
Image of page 4
Geometric Distribution k=1:20; y=mygeometric(20,0.5); k=1:20; y=mygeometric(20,0.1); function y=mygeometric(n,p) for k=1:n y(k)=(1-p)^(k-1)*p; end stem(k,y) stem(k,y) 0.5 p = 0.1 p =
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Poisson Distribution k=0:20; y=poisspdf(k,5); ( ) , 0,1,... ! k p k e k k λ λ = = 2 μ λ σ λ = = k=0:20; y=poisscdf(k,5); stem(k,y) Poisson 1837 stem(k,y) grid on 5 λ =
Image of page 6
Poisson Distribution k=0:10; y=mypoisson(10,0.1); stem(k,y) function y=mypoisson(n,lambda)
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}