How can I create a random array from a distribution?

I was wondering how can I create an array of certain dimensions (i.e. 1000x1) from a distribution object?

 採用された回答

the cyclist
the cyclist 2015 年 10 月 23 日

1 投票

N = 1000;
pd = makedist('Normal','mu',75,'sigma',10);
r = pd.random(N,1);

4 件のコメント

Gabs
Gabs 2015 年 10 月 23 日
thank you cyclist
the cyclist
the cyclist 2015 年 10 月 23 日
The best form of thanks is upvoting and/or accepting an answer, which rewards the person who helped you, and might also guide people who have similar questions.
Gabs
Gabs 2015 年 10 月 23 日
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 2015 年 10 月 23 日
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?

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

2015 年 10 月 23 日

コメント済み:

2015 年 10 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by