Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB 1. Write a MATLAB function that simulates an experiment in which a coin is flipped 100 times and the number of heads (successes) is

MATLAB

1. Write a MATLAB function that simulates an experiment in which a coin is flipped 100 times and the number of heads (successes) is recorded. The input to this function should be the probability of observing a heads and the output should be a number between 0 and 100.

2. In a separate script, use the function from 1. to simulate an experiment where you flip a fair coin (input to function is 0.5) 100 times, record the number of heads observed, and then repeat the coin flip experiment 10, 100, and 1000 times -- thus, for 10 repetitions, the resulting outcomes might look like [50,51,47,45,53,55,50,51,48,40]. Plot your results from the 10, 100, and 1000 repetitions of the 100 coin flip experiment in 3 separate histograms.

3. Redo the experiment in 2, but this time assume an unfair coin (probability of observing heads is 0.8)

4. Based on the histograms, how does it appear that the number of heads observed in 100 flips of a coin are distributed? Overlay the analytical distribution on the histogram of the simulated data.

5. Prove that the variance of the Poisson distribution with mean lambda is also lambda.

as a hint, the built-in rand function returns a random number from the uniform distribution between 0 and 1. Thus to simulate a single fair coin flip you might use something like:

if rand > 0.5

disp('heads')

else

disp('tails')

end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

What is job rotation ?

Answered: 1 week ago