Rolling Pairs of Dice

If you roll a pair of dice, their sum will be a number from 2 to 12. But the resulting numbers are not equally likely. For example, you are six times as likely to roll a score of 7 than a score of 2, because there are six possible outcomes that add to 7 (1+6, 2+5, 3+4, 4+3, 5+2, 6+1) yet only one outcome to achieve 2 (1+1). In fact, the expected probabilities of the various outcomes is well known to be
outcome: 2 3 4 5 6 7 8 9 10 11 12
probability: 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/36 2/36 1/36

Today, we will develop a program that performs an experiment by simulating N trials of rolling a pair of dice, and graphing a histogram of the outcomes versus the theoretical prediction. We will rely on MATLAB's existing histogram function, for producing such a figure. As an example, here is a graph of 1000 random trials.

Our goal is to write a script dicepair.m that produces such a figure, assuming that variable N is predefined to be the number of trials. We will work on this as a group. After class, I will post a sample solution.