How can I generate a sample of 1-D random numbers following Gaussian distribution

I want to generate a sample of 1-D random numbers in an interval [a, b] following Gaussian distribution (using the analytical expression for probability density distribution(PDF)).

1 件のコメント

Doug Hull
Doug Hull 2013 年 11 月 14 日
What would that even mean? Do you want to specify the mean and Standard deviation then truncate anything outside of [A,B]?

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

 採用された回答

Simon
Simon 2013 年 11 月 14 日
編集済み: Simon 2013 年 11 月 14 日
Hi!
It seems you already found your solution on file exchange. Why don't you use it?
Your input function will be
m=0;
sigma=1;
myfun = @(x) exp(-(x - m).^2 ./ (2*sigma^2)) ./ (sigma*sqrt(2*pi));

1 件のコメント

thoraya
thoraya 2013 年 11 月 15 日
Hi, it is true. I asked this question to make sure that I chose the right file. thanks for your help

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

質問済み:

2013 年 11 月 14 日

コメント済み:

2013 年 11 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by