How to find probability mass function

8 ビュー (過去 30 日間)
Derick Trinidad
Derick Trinidad 2020 年 10 月 27 日
コメント済み: Jehan Alsulaiman 2021 年 10 月 17 日
Good afternoon, I'm trying to use the finitepmf function to find the probability mass function. However, the current version of matlab doesn't have the finitepmf. Can anyone send me an example of an alternative way to solve pmf so i can get example 5.26 working?

採用された回答

Elias Tiso
Elias Tiso 2020 年 10 月 28 日
I had the same problem. I found a function definition for finitepmf() within this document:
function pmf=finitepmf(sx,px,x)
% finite random variable X:
% vector sx of sample space
% elements {sx(1),sx(2), ...}
% vector px of probabilities
% px(i)=P[X=sx(i)]
% Output is the vector
% pmf: pmf(i)=P[X=x(i)]
pmf=zeros(size(x(:)));
for i=1:length(x)
pmf(i)= sum(px(find(sx==x(i))));
end
end
  1 件のコメント
Jehan Alsulaiman
Jehan Alsulaiman 2021 年 10 月 17 日
I get an error on mf=zeros(size(x(:)));
it says not enough arguments
'Not enough input arguments.'

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by