Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started