{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Microsoft PowerPoint - Introduction to Matlab3

Microsoft PowerPoint - Introduction to Matlab3 - MATLAB...

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

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

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

View Full Document
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
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 = =

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

View Full Document
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])
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 =

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

View Full Document
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 λ =
Poisson Distribution k=0:10; y=mypoisson(10,0.1); stem(k,y) function y=mypoisson(n,lambda)

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}