Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function called event that simulates the scenerio below. The function should have no inputs and a single output that must be either 0

image text in transcribed

image text in transcribed

Write a function called event that simulates the scenerio below. The function should have no inputs and a single output that must be either 0 or 1 A fair coin is tossed 5 times. Simulates the 5 tosses and returns as the output the value of 1 if the coin flip resulted in heads for at least 3 consecutive tosses, otherwise, your function should return 0 Your Function C Reset MATLAB Documentation 1 function out event Code to call your function C Reset .%This script calculates the approximate probability 2 cnt-0: 3 for j-1:1000 cnt cnt+event; 5 end 6 100*(cnt/1000) Write a function called event that simulates the scenerio below. The function should have no inputs and a single output that must be either O or 1 A class of 4 girls and 3 boys is told to line up and do so randomly. Simulate the students lining up and have your function return as an output the value of 1 if the students line up girl, boy, girl, boy, girl, boy, girl perfectly. Your function should return a 0 otherwise. Hint: See the function randperm. Your Function C Reset MATLAB Documentation 1 function out-event Code to call your function C Reset 1 This script calculates the approximate probability 21 cnt=0; 3 for j=1:1000 4 s end 6 100* (cnt/1000) cnt cnt+event; Write a function called event that simulates the scenerio below. The function should have no inputs and a single output that must be either 0 or 1 A fair coin is tossed 5 times. Simulates the 5 tosses and returns as the output the value of 1 if the coin flip resulted in heads for at least 3 consecutive tosses, otherwise, your function should return 0 Your Function C Reset MATLAB Documentation 1 function out event Code to call your function C Reset .%This script calculates the approximate probability 2 cnt-0: 3 for j-1:1000 cnt cnt+event; 5 end 6 100*(cnt/1000) Write a function called event that simulates the scenerio below. The function should have no inputs and a single output that must be either O or 1 A class of 4 girls and 3 boys is told to line up and do so randomly. Simulate the students lining up and have your function return as an output the value of 1 if the students line up girl, boy, girl, boy, girl, boy, girl perfectly. Your function should return a 0 otherwise. Hint: See the function randperm. Your Function C Reset MATLAB Documentation 1 function out-event Code to call your function C Reset 1 This script calculates the approximate probability 21 cnt=0; 3 for j=1:1000 4 s end 6 100* (cnt/1000) cnt cnt+event

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

List the components of the strategic management process. page 72

Answered: 1 week ago