Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function called event that simulates the scenario below. The function should have no inputs and a single output that must be either 0
Write a function called event that simulates the scenario below. The function should have no inputs and a single output that must be either 0 or 1. A given bag of candy has 60 pieces of candy. Each piece of candy has an equal probability of being any one of four different flavors. Simulate a bag of candy and have your function return a 1 if there are 4 or fewer pieces of a given flavor. If there are 5 or more pieces of all four flavors, return a 0. Function C Reset MATLAB Documentation 1 function out=event Code to call your function C Reset 1 %This script calculates the approximate probability cnt=0; 3 for j=1:1000 4 cnt=cnt+event; 5 end 100*(cnt/1000)
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