If we have a discrete random variable x and the data pertaining to it in X(n), how in matlab can we determine the probability mass function pmf(X)?
The following excerpt from the MATLAB documentation shows how to plot a histogram. For a discrete probability function, the frequency distribution might be identical with the histogram.
x = -4:0.1:4;
y = randn(10000,1);
n = hist(y,x);
pmf = n/sum(n);
plot(pmf,'o');
Calculate the sum of all the elements in every bin. Divide all bins by the sum to get your pdf. Test your pdf by adding up all elements. The result must be one.
Hope I'm right with my statements. It's a long time since ...