Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please perform this in MatLab Prototyping and Projects (ECE 112) MatLab Birthday Perhaps you've heard that in a group of 23 people the odds are
Please perform this in MatLab
Prototyping and Projects (ECE 112) MatLab Birthday Perhaps you've heard that in a group of 23 people the odds are about even that two people will have the same birthday. To put this another way, if you were to create 1000 random groups of people there should be about 500 of these groups that have two people with the same birthday. If you increase the size of the group to 50 people there is a 97% chance that two people have the same birthday. Your goal is to create a program in Matlab that will find the percent chance that a group of size n has at least two people with the same birthday. You will do this by creating 1000 random groups of size n and testing to see how many of them have the same birthday. The number of people in the group (n) should be an input into the program. Turn in the following items: E-mail Dr. Woolverton your Matlab code. Here are some tips: You don't need to assign an actual birthday to each person. A number from 1 to 365 will work. You don't need to consider leap years. . Use the rand command to assign each person a birthday number. The rand command gives a random number between 0 and 1. How can you make this a random number between 1 and 365? You may also find the ceil command helpful. Don't try to tackle the whole problem at once. First try and create a program that gets the input of n and creates an array that contains n random birthdays. You can use the sort command to rearrange the array from lowest to highest. To check if a = b you should use: if a == b Each time you find a birthday match in a group, set a counter. You can do this very simply with something like: count=count+1 . Once you get the program to get the input, form the birthdays and check for matches, add a loop so that you are doing it 1,000 times. Prototyping and Projects (ECE 112) MatLab Birthday Perhaps you've heard that in a group of 23 people the odds are about even that two people will have the same birthday. To put this another way, if you were to create 1000 random groups of people there should be about 500 of these groups that have two people with the same birthday. If you increase the size of the group to 50 people there is a 97% chance that two people have the same birthday. Your goal is to create a program in Matlab that will find the percent chance that a group of size n has at least two people with the same birthday. You will do this by creating 1000 random groups of size n and testing to see how many of them have the same birthday. The number of people in the group (n) should be an input into the program. Turn in the following items: E-mail Dr. Woolverton your Matlab code. Here are some tips: You don't need to assign an actual birthday to each person. A number from 1 to 365 will work. You don't need to consider leap years. . Use the rand command to assign each person a birthday number. The rand command gives a random number between 0 and 1. How can you make this a random number between 1 and 365? You may also find the ceil command helpful. Don't try to tackle the whole problem at once. First try and create a program that gets the input of n and creates an array that contains n random birthdays. You can use the sort command to rearrange the array from lowest to highest. To check if a = b you should use: if a == b Each time you find a birthday match in a group, set a counter. You can do this very simply with something like: count=count+1 . Once you get the program to get the input, form the birthdays and check for matches, add a loop so that you are doing it 1,000 timesStep 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