This is a problem related to create random number with matlab...

1 view (last 30 days)
I want to create a series of random numbers meet exponential distribution between the interval:[15,145]....How should I write the programme?(The matlab version I use now is matlab 7.0)

Answers (1)

Walter Roberson
Walter Roberson on 4 Sep 2015
If you have the Statistics Toolbox then you can use exprnd and then discard values that are outside our target range. Keep generating samples and discarding unwanted ones until you have enough samples for your purpose.
Note: the exponential distribution has an infinite tail, so when you restrict to a particular finite range, the resulting numbers with not have a measured exponential distribution.

Categories

Find more on Random Number Generation 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!