Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The experiment: flip a fair coin 150 times, tallying at each time whether we fli

ID: 3660586 • Letter: T

Question

The experiment: flip a fair coin 150 times, tallying at each time whether we flip heads or tails, and keeping track of the percentage of heads as we go.

On a fair coin, there is 50% chance of flipping heads, and 50% chance of flipping tails. We will use random numbers to simulate this. On the interval 0 to 1, everything below .5 will represent a

Explanation / Answer

here coins undefined trial undefined u should make these two function here m giving one code function avgflips=coinflip(initP1,initP2,initP3,p,n) X =(rand(3,1)>p); count=zeros(n,1); for i=1:n playercoins=zeros(3,1); playercoins(1,1)=initP1; playercoins(2,1)=initP2; playercoins(3,1)=initP3; c=1; j=1; while j>0 if X(1,1)==X(2,1) && X(2,1)==X(3,1) playercoins=playercoins; elseif X(1,1)~=X(2,1) && X(1,1)~=X(3,1) && X(2,1)==X(2,1) playercoins=playercoins+[2;-1;-1]; elseif X(1,1)~=X(2,1) && X(1,1)==X(3,1) && X(2,1)~=X(3,1) playercoins=playercoins+[-1;2;-1]; elseif X(1,1)==X(2,1) && X(2,1)~=X(3,1) && X(1,1)~=X(3,1) playercoins=playercoins+[-1;-1;2]; end if playercoins(1,1)==0 j=0; elseif playercoins(2,1)==0 j=0; elseif playercoins(3,1)==0 j=0; end c=c+1; end count(i)=c; end avgflips=mean(count); end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote