function diehist( x ) % plots a normalized histogram of random numbers x drawn from rolling a % die. [h,b] = hist( x, 1:6 ); h = h/sum(h); % normalization plot( [0 7], [1/6 1/6], 'r', 'linewidth', 3 ) hold on bar( b, h ); hold off set(gca, 'XTick', 1:6 ); xlim( [ 0, 7 ] ); xlabel('Eyes'); ylabel('Probability'); end