How to sample from a distribution?

134 ビュー (過去 30 日間)
L'O.G.
L'O.G. 2023 年 1 月 20 日
コメント済み: Star Strider 2023 年 1 月 21 日
How do you use randsample (or maybe something else?) to sample from a distribution? Can you define a non-standard distribution as long as you have the formula for the pdf?

採用された回答

Star Strider
Star Strider 2023 年 1 月 20 日
How do you use randsample (or maybe something else?) to sample from a distribution?
The random function can be used with known distributions.
Can you define a non-standard distribution as long as you have the formula for the pdf?
Yes. See Nonparametric and Empirical Probability Distributions for an extensive discussion. The ecdf function can be used to define an empirical distibution. (Getting random numbers from it would likely require inverting its pdf first, and that could be something of a challenge, depending on the distribution.)
.
  4 件のコメント
L'O.G.
L'O.G. 2023 年 1 月 20 日
Thank you! I'll ask a similar question separately, since I think it pertains to this question. Maybe you can help me with it.
Star Strider
Star Strider 2023 年 1 月 21 日
As always, my pleasure!
I will do my best!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by