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

Write a program to simulate coin tosses. Probability of heads in a coin toss exp

ID: 3789361 • Letter: W

Question

Write a program to simulate coin tosses. Probability of heads in a coin toss experiment is p where p is equal to the average of the numbers in your RUID divided by 10. Generate a figure which plots the frequency of heads f(n) in n coin tossing where f is shown on y axis and n is on x-axis. Frequency of heads f(n) is computed as the number of heads observed within n trials divided by n. See the example below. General remarks about the assignments: The code for the program you Implemented must be included in your work. You can use any tool or programming language you like Reasoning for your answers should be properly written A correct answer itself without enough explanation will not get full credit. Your submission should be a Single PDF file. Your submission may not be accepted if it is not PDF. The deadline will be given on the sakal assignment description. You are not allowed to submit after the deadline. Please do not email your work to TAs, email submissions will not be accepted, you can only upload on sakai. You can discuss with others but obviously you are not allowed to copy from others Turntin will be used to check the originality of your work for all the assignments and you must cite or quote any resource used. Any questions/comments about the assignments are obviously we come Posting questions on Plazza is strongly encouraged since everyone will benefit from the answers. You can ask questions about the assignments to TAs during their office hours If questions regarding the homework are asked during the recitation. TAs can ask you to see them offline If there IS not enough time to answer or if they don't know the answer right away Please keep in mind that TA's are NOT supposed to solve the assignment for you but only help.

Explanation / Answer

I am writing a matlab code which will help to uderstand the problem and solution:


trials = 1:2000;
heads = 0;
t = rand(2000,1);

perh=zeros(size(t));

for i = trials

if (t(i) < 0.5)
heads = heads + 1;
end
perh(i) = heads/i;
end
plot(trials,perh)
xlabel('Trial Number')
ylabel('Percent Heads')
title ('Trial Number vs Percent Heads')

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