Question: Please typ out code on matlab and run it to make suree no errors occur 7. Simulate a coin flip experiment in MATLAB: In this

Please typ out code on matlab and run it to make suree no errors occurPlease typ out code on matlab and run it to make suree

7. Simulate a coin flip experiment in MATLAB: In this problem we wll use MATIAB to simulate an experiment with 60 coin flips. Let us denote 1 as Head and s Tail. Let the probability of head be p. You can set this value to some constant in MATLAB Use the function rand to generate 60 numbers between 0 and 1. If an element is less than p convert that to 0, otherwise to 1. This gives you a vector with zeros and ones. Repeat this for 1000 times. For beginners you can use a for loop for this though there are better options) Find out the following: Number of experiments in which you got at least 10 heads. Number of experiments in which you got no head Number of experiments in which the number of heads and tails were equa Report these values. Use the fprintf(...) function for this. Use the values you obtained to compute the probability for each of the events mentioned above. You can use the following sample code as reference: 98% You can try publishing the code as an HIML (Optional) % Begin your code with the %%" for this and give a title % Publish as H1ML and print it as pdf and attach with your % submission. This is optional for this assignment cle;clear close al1 p 0.6; % Put any value you like % Place other things you need to initialize for -1:1000 Exp= rand ( ); % fill this up % Count the various values end % print the values fprintf('Print the values required. Use %d or%f to format the numbers') Try to avoid any more for loops

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!