Engineering and Computing
Please complete the following exercise and write a concise sub-report documenting and explaining
your solutions (MAXIMUM 4 pages). Please note that your report must reference any sources, such
as textbooks or web pages, that you have used to help develop your solution
This is the last assignment, which is designed to assess your overall understanding of the module
concepts and Matlab programming. Homework must be submitted before the end day of
09/December/2014.
What to turn in: Copy the text from your scripts and paste it into a document. If a question asks you
to plot or display something to the screen, also include the plot and screen output your code
generates. Submit a printed report and email me the .doc or .pdf file.
1. (23 Marks)
When a fair dice is rolled, the number uppermost is equally likely to be any integer from 1 to 6, i.e.
theoretically the expected probability of getting any value is 1/6. We need to do a simulation
experiment to check this theory and analyze the results (simulation is when we use random numbers
to mimic a real situation based on chance).
1- Create a function which generates a vector with n random integers in the range 1-6, this
function should have the following definition:
function createDiceExperiment(filename, n)
% filename: the name for saving the generated numbers
% n: the number of random integers in this experiment.
2- Call this method 4 times with 4 different filenames; n should have the following values
accordingly 10,100, 1000, 10000 (the number of times can be a variable also which you need
to read it from the user input, i.e. the user can select the number of experiments and their n
values accordingly).
3- for each experiment, we need to load its file and count the number of “sixes” thrown by
summing the elements of the logical vectord == 6 (or using a loop)
4- Estimate the probability of throwing a six by dividing the number of sixes thrown by the
number of trials in this experiment.
5- Use the built-in functions to find the minimum, maximum, mean, median, standard
deviation, and mode of getting sixes for all experiments
6- Plot the graphs to explain the difference in values.
7- Analyze the results.
2. Portfolio of Work Submission (10 Marks)
Please refer to the Guidelines document for Portfolio of Work submission. The following pieces of
work should be included in your portfolio:
Annotated screenshots of code used from each workshop activity.
Accompanying discussion of each workshop activity, demonstrating your understanding of new
concepts.
A section explaining how Matlab code is executed. This can include pictures/diagrams as
necessary.
PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET AN AMAZING DISCOUNT 🙂