Write a matlab program that rolls a fair 10-sided dice

Assignment Help Computer Engineering
Reference no: EM132206053

(a) Write a MATLAB program that rolls a fair 10-sided dice (whose faces go from 0 to 10) for some given number of times. In other words, you will pick a number uniformly at random on from {1, 2, 3, . . . 10} a number of times independently.

(b) Roll the dice 100 times, and meanwhile count the number of times you obtain each face. Write down the frequency of each face. For example, if you got 13 1s out of the 100 rolls, your result would be 0.13 for 1. Plot a graph that shows the face in the X-axis vs frequency in the Y-axis.

(c) Repeat (b) for 1000000 (one million) rolls.

(d) What we have done so far can be considered as the use of computer to and an approximation to the PMF of the dice roll. Compare the results you obtained in (b) and (c) with the "actual" PMF of the roll of the 10-sided fair dice. This so-called Monte Carlo method is pretty powerful and can be used to approximate the probabilities of events that are hard to calculate using formal methods.

(d) As another exercise, using one million rolls of the dice, approximate the PMF of X + |X-6|, where X is the random variable that is uniform on {1,2,3 ....10} (Rolls of the 10-sided dice). Compare what you obtain with the exact PMF of X + |X-6|. Plot both the approximate PMF and the actual PMF.

*hint

a) Type x = rand, and hit enter. Nice; the function rand is like a continuous random variable that is uniformly distributed on [0, 1]. We now need to nd a way to obtain a discrete random variable out of this continuous random variable.

b) Think about what type of numbers would you get from x = ceil(10*rand). Type help ceil to the command line to see what ceil does.

Reference no: EM132206053

Questions Cloud

Write a test program to declare and initialize two integer : Write a method called logicAnd that accepts as parameters two arrays of integer (A and B) and returns another array of integer (C).
Write a method called append that accepts two integer : Write a method called append that accepts two integer arrays as parameters and returns a new array that contains the result of appending the second array.
Write a merge program that merges two ordered lists : Write a "merge" program that merges two ordered lists of integers into a new ordered list.
Design for the business and application domains : MN503 - Network requirement analysis and plan - Investigate and develop an architectural internetworking design for the business and application domains
Write a matlab program that rolls a fair 10-sided dice : Write a MATLAB program that rolls a fair 10-sided dice (whose faces go from 0 to 10) for some given number of times.
Prompt the user for an integer between 10 and 100 : Write a MATLAB script (write using MATLAB) that prompts the user for an integer between 10 and 100 by displaying.
Write a matlab script to numerically solve any first order : Write a MATLAB script file to numerically solve any first order initial value problem using Rulers method.
Accept a two-dimensional array of integers as a parameter : Write a method called is Magic Square that accepts a two-dimensional array of integers as a parameter and returns true if it is a magic square.
Disadvantages of adding indexes to a database tables : What are the advantages and disadvantages of adding indexes to a database tables?

Reviews

Write a Review

Computer Engineering Questions & Answers

  What amazing things did he do with encodings

How did she contribute to programming languages? Look up Kurt Godel on the Web. What amazing things did he do with encodings?

  Describe how are the topics of the two articles related

Prepare a brief synthesis and summary of the two articles. Describe How are the topics of the two articles related? What information was relevant and why?

  Generating ten random permutations

Write down a program which generates ten random permutations of numbers 1 to 10. To produce a random permutation, you require filling a vector along with the numbers 1 to 10 so that no two entries of vector have the same contents.

  Prepare a web page about your favorite recipe

Prepare a Web page about your favorite recipe. Use an unordered list for the ingredients and an ordered list to describe the steps needed to prepare the food.

  Program to calculate area and perimeter of rectangle

Write down a program which asks for length L and the width W of a rectangle, then the computer perimeter and area of rectangle.

  Describe virtual and augmented reality

Describe virtual and augmented reality. Suggest a way in which this technology could be used in the future; either to improve a current process.

  Develop a nested multiplication for the product

Modify MatMatDot so that it efficiently handles the case when A is lower triangular and B are upper triangular and both are n-by-n.

  Consider a rectangular array of cells

The game of Life, invented by the mathematician John H. Conway, is intended to model life in a society of organisms. Consider a rectangular array of cells, each of which may contain an organism.

  Computing roots of the function f

The best known iterative method in order compute the roots of the function f (that is, the x-values for which f(x) is 0) is Newton-Raphson approximation.

  What do you think about the chaos studys definition

Do you think there are better definitions of success besides meeting scope, time, and cost goals?

  Write a program that inputs the number of hours worked

Write a program that inputs (from the user) the number of hours worked and hourly pay rate for employees and outputs their total pay.

  How would you modify the circuit in digital experiment

How would you modify the circuit in Digital_Exp_06_Part_02a to create a 12-bit adder? What additional parts would the circuit require?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd