フィルターのクリア

How to sample in matlab by multinomial distribution?

5 ビュー (過去 30 日間)
dragoon
dragoon 2015 年 11 月 12 日
コメント済み: dragoon 2015 年 11 月 12 日
I know for a random variable x that P(x=i) for each i=1,2,...,100. Then how may I sample x by multinomial distribution, based on the given P(x=i) in matlab?
I am allowed to use matlab build in commend
rand
and
randi
but not
mnrnd.
Thank you!
  2 件のコメント
James Tursa
James Tursa 2015 年 11 月 12 日
What have you done so far?
dragoon
dragoon 2015 年 11 月 12 日
I use
t = cmusum(P)
command to compute the cdf of P(x=i). Then I use
rand
to find a number between (0,1), and find for what i that t(i)>rand. Then I output x(i).
This is my impression for sampling with a distribution. But I am not sure this is sampling with mutinoimal distribution...

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

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by