How can I generate a sample of 1-D random numbers following Gaussian distribution
7 views (last 30 days)
Show older comments
thoraya on 14 Nov 2013
Commented: thoraya on 15 Nov 2013
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)).
Doug Hull on 14 Nov 2013
What would that even mean? Do you want to specify the mean and Standard deviation then truncate anything outside of [A,B]?
Simon on 14 Nov 2013
Edited: Simon on 14 Nov 2013
It seems you already found your solution on file exchange. Why don't you use it?
Your input function will be
myfun = @(x) exp(-(x - m).^2 ./ (2*sigma^2)) ./ (sigma*sqrt(2*pi));
Edit: Forgot the link: 1-D random number generation with any analytical expression probability density function
More Answers (0)
Find more on Multivariate Normal Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!