Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

sampling from a distribution.

Asked by sepideh on 12 Jul 2013

I want to get random samples from a mixture distribution for monte carlo approach. What are some matlab function that can be used?




No products are associated with this question.

1 Answer

Answer by Image Analyst on 12 Jul 2013

I don't know what distributions you want, but you might try the rand() function. Or if you want a specific distribution, you might try RANDRAW: which has about 50 of them.


sepideh on 13 Jul 2013

Thanks, The distribution is a mixture of gamma and generalized normal distribution in which case i need a function that gets my distribution from an m file and randomly selects from it.

Image Analyst on 13 Jul 2013

In general you need to construct the CDF of your PDF and then put in a random number to get your random draw. See this for more info:

Image Analyst

Contact us