Probabilityforacointoss

Probabilityforacointoss - disp(S);%displays the sum of...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%Probability distribution for a fair coin n=input('enter number of tosses:'); k=0:n; N=n*ones(1,n+1); a=factorial(N); b=factorial(k); c=factorial(N-k); BC=a./(b.*c); P=BC/(2^n); S=sum(P); disp([k' P']);%displays the probabilities disp([k' BC']);%displays the binomial coefficients
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: disp(S);%displays the sum of probabilities which should equal one subplot(1,2,1);%these commands plot a graph and a bar graph of the data on the same %plot plot(k,P,'r'),grid; subplot(1,2,2); bar(k,P);...
View Full Document

This note was uploaded on 11/06/2011 for the course EE 150 taught by Professor Dr.burke during the Fall '08 term at USC.

Ask a homework question - tutors are online