next up previous index
Next: Definition of Probability 9/25 Up: Sample Space 09/24 Previous: Sample Space 09/24

Matlab Dice Example from lecture 09/24/98

After typing matlab on a leland prompt after logging in. Try the following commands to simulate tossing dice:
>> unidrnd(6)
ans =
     5
>> unidrnd(6)
ans =
     6
>> unidrnd(6)
ans =
     3
>> unidrnd(6)
ans =
     1
>> unidrnd(6)
ans =
     4
>> unidrnd(6)
ans =
     5
>> unidrnd(6)
ans =
     1
>> unidrnd(6)
ans =
     3
>> mat10=unidrnd(6,1,10)
mat10 =
     1     3     5     4     6     6     4     1     4     3
>> sum(dice1000<4)
ans =
   498
>> sum(dice1000>3 & dice1000<6)
ans =
   347
>> sum(dice1000==6)
ans =
   155
-------------------end for 09/24/98-----



Susan Holmes
1998-12-07