% L6B demo % Sum of three dice -- empirical distribution % % Parameters: % n Size of sample (each die rolled n times) % % Returns: % p Relative frequencies of values 1...18 % function p = L6Bthreedice_sampling(n) if nargin<1, n=100; end x = dice(n); y = dice(n); z = dice(n); s = x+y+z; p = hist(s, 1:18) / n; end