How can I create a random array from a distribution?

3 vues (au cours des 30 derniers jours)
Gabs
Gabs le 23 Oct 2015
Commenté : the cyclist le 23 Oct 2015
I was wondering how can I create an array of certain dimensions (i.e. 1000x1) from a distribution object?

Réponse acceptée

the cyclist
the cyclist le 23 Oct 2015
N = 1000;
pd = makedist('Normal','mu',75,'sigma',10);
r = pd.random(N,1);
  4 commentaires
Gabs
Gabs le 23 Oct 2015
Actually, I am having trouble. I want a random set of numbers from a normal distribution object with a given mu and sigma. However, I need to truncate the distribution. After I truncate it, I am getting a random set of numbers that is NOT normally distributed
the cyclist
the cyclist le 23 Oct 2015
I'm not sure exactly what you mean. A truncated normal is not a normal. Maybe you need something like a beta distribution, where you can choose parameters that make it symmetric, but it has a finite range?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by