On 5/18/2012 10:27 PM, yugandhar ch wrote:
> how to generate random numbers from double exponential distribution,pl give function
I assume you are asking becuase Matlab does not have this distribution.
I did not check.
There is a known general method which can be used to
generate random numbers from different distributions by
only using the uniform random number generator.
This is called the F^1 method. This is the only I know
about now, since that is what we learned at school.
I'll show you how I did one for the exponential distribution with
parameter lamda. You can use for the double exponential distribution.
The CDF for the exponential distribution is given by
F(x)=1exp(lambda*x) x>=0, and 0 otherwise
Hence the inverse CDF comes out to be (little algebra)
F^1(y)=1/lambda * ln(1y)
Now, generate a random number from U(0,1), this is just using
matlab's rand, see help. Let this number of z.
Then a random number from the exponential distribution will
be
1/lambda*ln(1z)
i.e. the inverse CDF function is a function of the U(0,1) random
numbers.
So, generate a number from U(0,1), and call the above function, this
will give you the random number from the exponential distribution.
Just do the same for any other distributions. The trick is to be
able to determine the inverse cdf.
I just looked up the double expo. distribition. The CDF is
given by exp(x)/2 for x<0 and 1exp(x)/2 otherwise.
Hence it is easy to apply the F^1 to it.
Nasser
