Is there a Matlab function which builds up the exact probability mass function (or probability density function) given a vector of data?
I mean something like this:
X = [1 2 4 1 4 3 2 3 4 1];
[x px] = a_function(X)
x =
1 2 3 4
px =
0.3 0.2 0.2 0.3
you can use
accumarrayor
hist:or
tabulate:and there’s probably at least 10 more ways doing so…
for
pxjust usepx=unique(X), ort(:, 1)in thetabulatesolution, etc…