IEN310: MATLAB Assignment #1 IEN310: MATLAB Assignment #1 Due: March 31st In this assignment, you will be simulating the rolling of a balanced six-faced die. You will roll the die 1200 times and...

1 answer below »
Attached I just need the file to have my name on it As Kamil asali on it


IEN310: MATLAB Assignment #1 IEN310: MATLAB Assignment #1 Due: March 31st In this assignment, you will be simulating the rolling of a balanced six-faced die. You will roll the die 1200 times and examine the first 12, 120, and 240 of those rolls, as well as all 1200 rolls. For each of these numbers of rolls you will compute the observed probabilities of obtaining each of the six outcomes, and compare these probabilities with the real probabilities of getting these outcomes. Assignment 1 Your MATLAB file should be named Assignment1.m. This program should do the following: 1. Using the random number function, rand, generate a 10 ( 1200 array of random numbers between 0 and 1 in the array X. The 10 rows represent ten different experiments and the 1200 columns represent 1200 trials (i.e., rolls) in each experiment. 2. Using the ceil function, randomly select a row from X. 3. From this selected row, write code to convert the 1200 random numbers into outcomes of a single roll of a die (1, 2, 3, 4, 5, and 6). 4. Extract the first 12, 120, and 240 rolls, as well as all 1200 rolls, into separate variables that will be needed later to compute basic descriptive statistics. 5. Create a variable to count the number of times (i.e., compute the frequencies) that each of the six outcomes occurs. You need to obtain the number of times each of these outcomes occurs in the first 12 trials (i.e., the first 12 values of X), as well as the first 120, 240, and in all 1200 values of this row. 6. Next, you need to create a variable that converts these frequencies into probabilities by dividing by the corresponding number of trials. You also need to have available in one of the rows of this variable the real probabilities associated with each of the six outcomes. 7. Plot probability (y-axis) versus roll outcome (x-axis). There should be 4 lines plotted: one each for the 12, 120, 240, and 1200 trial situations and one line that represents the real probability values for each of these six outcomes. The real probability line should be a solid line. Make sure the axes are labeled and the plot is titled. Also, ensure that the x-axis contains the six outcome values, and that there is a legend. Many of these formatting adjustments can be made after the plot is generated while working with the menu options available with the figure plot. You can click on the legend values and enter the 12, 120, 240, 1200, and “Real” designations for each of the legend symbols. 8. Finally, using the mean and std functions, you should compute the sample mean and sample standard deviation for the 12 rolls, 120 rolls, 240 rolls, and 1200 rolls. Make sure you can see these values in the MATLAB Command Window (by not ending the corresponding lines of code with a semi-colon). Note these values. In the legend of your figure generated by running the program, click in the legend box and alongside each of the rows (12, 120, 240, and 1200), note the mean and standard deviations you found. Alongside “Real,” put in the values corresponding to E[X] and STD[X] (which is the square root of the computed Var[X]). 9. Run your program three times. Each run should result in a different plot, so you should have three plots. 10. Your report should consist of your program code, the plots, and answers to the following questions: (a) In general, how different are the three plots from one another (give an example to illustrate your point)? (b) Why should there be variability across these plots? (c) Generally, is there a pattern between the sample size (i.e., number of trials) and the real means and standard deviations? (d) Overall, at which number of trials do the observed probabilities appear to begin to converge to the real probability values? Answers to Assignment 1a (see plots) (a) In general, how different are the three plots from one another? There are some clear differences between the plots. For example, for 12 trials, one could see quite a bit of variation between the plots, whereas for higher numbers of trials the variation will be less. However, there are still differences if we compare the plots to the solid line. (b) Why should there be variability across these plots? Because these plots are based on different experiments—that is, the generation of different random numbers. (c) Is there a pattern between the sample size (i.e., number of trials) and the real means and standard deviations? The sample means appear to converge to the real means with increased number of trials. A pattern of variability with increased sample size seems less evident. (d) Overall, at which number of trials do the observed probabilities appear to begin to converge to the real probability values? Looking at all three plots together, convergence seems to be occurring at about XXX trials. PAGE 2 IEN310: MATLAB Assignment #1 IEN310: MATLAB Assignment #1 Due: March 31st In this assignment, you will be simulating the rolling of a balanced six-faced die. You will roll the die 1200 times and examine the first 12, 120, and 240 of those rolls, as well as all 1200 rolls. For each of these numbers of rolls you will compute the observed probabilities of obtaining each of the six outcomes, and compare these probabilities with the real probabilities of getting these outcomes. Assignment 1 Your MATLAB file should be named Assignment1.m. This program should do the following: 1. Using the random number function, rand, generate a 10 ( 1200 array of random numbers between 0 and 1 in the array X. The 10 rows represent ten different experiments and the 1200 columns represent 1200 trials (i.e., rolls) in each experiment. 2. Using the ceil function, randomly select a row from X. 3. From this selected row, write code to convert the 1200 random numbers into outcomes of a single roll of a die (1, 2, 3, 4, 5, and 6). 4. Extract the first 12, 120, and 240 rolls, as well as all 1200 rolls, into separate variables that will be needed later to compute basic descriptive statistics. 5. Create a variable to count the number of times (i.e., compute the frequencies) that each of the six outcomes occurs. You need to obtain the number of times each of these outcomes occurs in the first 12 trials (i.e., the first 12 values of X), as well as the first 120, 240, and in all 1200 values of this row. 6. Next, you need to create a variable that converts these frequencies into probabilities by dividing by the corresponding number of trials. You also need to have available in one of the rows of this variable the real probabilities associated with each of the six outcomes. 7. Plot probability (y-axis) versus roll outcome (x-axis). There should be 4 lines plotted: one each for the 12, 120, 240, and 1200 trial situations and one line that represents the real probability values for each of these six outcomes. The real probability line should be a solid line. Make sure the axes are labeled and the plot is titled. Also, ensure that the x-axis contains the six outcome values, and that there is a legend. Many of these formatting adjustments can be made after the plot is generated while working with the menu options available with the figure plot. You can click on the legend values and enter the 12, 120, 240, 1200, and “Real” designations for each of the legend symbols. 8. Finally, using the mean and std functions, you should compute the sample mean and sample standard deviation for the 12 rolls, 120 rolls, 240 rolls, and 1200 rolls. Make sure you can see these values in the MATLAB Command Window (by not ending the corresponding lines of code with a semi-colon). Note these values. In the legend of your figure generated by running the program, click in the legend box and alongside each of the rows (12, 120, 240, and 1200), note the mean and standard deviations you found. Alongside “Real,” put in the values corresponding to E[X] and STD[X] (which is the square root of the computed Var[X]). 9. Run your program three times. Each run should result in a different plot, so you should have three plots. 10. Your report should consist of your program code, the plots, and answers to the following questions: (a) In general, how different are the three plots from one another (give an example to illustrate your point)? (b) Why should there be variability across these plots? (c) Generally, is there a pattern between the sample size (i.e., number of trials) and the real means and standard deviations? (d) Overall, at which number of trials do the observed probabilities appear to begin to converge to the real probability values? Answers to Assignment 1a (see plots) (a) In general, how different are the three plots from one another? There are some clear differences between the plots. For example, for 12 trials, one could see quite a bit of variation between the plots, whereas for higher numbers of trials the variation will be less. However, there are still differences if we compare the plots to the solid line. (b) Why should there be variability across these plots? Because these plots are based on different experiments—that is, the generation of different random numbers. (c) Is there a pattern between the sample size (i.e., number of trials) and the real means and standard deviations? The sample means appear to converge to the real means with increased number of trials. A pattern of variability with increased sample size seems less evident. (d) Overall, at which number of trials do the observed probabilities appear to begin to converge to the real probability values? Looking at all three plots together, convergence seems to be occurring at about XXX trials. PAGE 2
Answered 1 days AfterMar 29, 2021

Answer To: IEN310: MATLAB Assignment #1 IEN310: MATLAB Assignment #1 Due: March 31st In this assignment, you...

Abr Writing answered on Mar 30 2021
138 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here