How to sample from a distribution?

131 visualizaciones (últimos 30 días)
L'O.G.
L'O.G. el 20 de En. de 2023
Comentada: Star Strider el 21 de En. de 2023
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?

Respuesta aceptada

Star Strider
Star Strider el 20 de En. de 2023
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 comentarios
L'O.G.
L'O.G. el 20 de En. de 2023
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 el 21 de En. de 2023
As always, my pleasure!
I will do my best!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by