Determining probability mass function of random variable

后端 未结 6 649
一整个雨季
一整个雨季 2021-01-13 04:01

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)?

6条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-13 04:40

    Maybe try making just a function handle so you don't need to store another array:

    pmf = @(x) arrayfun(@(y) nnz(DATA==y)/length(DATA),x);
    

提交回复
热议问题