% HISTPROB % Demo for Lecture 6B % Calculate the probability of a particular histogram % (vector of counts) when sampling from uniform distribution % over an interval, and making histogram with equally wide categories. % % Input: Heights of the histogram bars. % function f=histprob(nn) k = length(nn); % Number of bars (categories) n = sum(nn); % Sample size (sum of bar heights) p = 1/k; % Probability of a point landing in a particular interval f = multinomial_coefficient(n,nn) * p^n;