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

조회 수: 6 (최근 30일)
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개)

Community Treasure Hunt

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

Start Hunting!

Translated by