Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
random numbers

Subject: random numbers

From: yugandhar ch

Date: 14 Jul, 2012 06:07:28

Message: 1 of 9

how to genetate random numbers from a distribution with function
F(x) = 1 - e^(-(x-alpha)/theta),

Subject: random numbers

From: Nasser M. Abbasi

Date: 14 Jul, 2012 06:55:50

Message: 2 of 9

On 7/14/2012 1:07 AM, yugandhar ch wrote:
> how to genetate random numbers from a distribution with function
> F(x) = 1 - e^(-(x-alpha)/theta),
>

There is a general method to generate random numbers
from different pdf's by using the uniform buildin random
number.

see this for example. You just need to be able to inverse your
pdf function above.

http://www.mathworks.com/matlabcentral/newsreader/view_thread/320209#877246

--Nasser

Subject: random numbers

From: Bruno Luong

Date: 14 Jul, 2012 06:59:46

Message: 3 of 9

"yugandhar ch" <yug_0203@rediffmail.com> wrote in message <jtr2b0$ord$1@newscl01ah.mathworks.com>...
> how to genetate random numbers from a distribution with function
> F(x) = 1 - e^(-(x-alpha)/theta),

Fantasy question: this is not a valid distribution, since it is not L1-integrable.

Bruno

Subject: random numbers

From: Nasser M. Abbasi

Date: 14 Jul, 2012 07:26:28

Message: 4 of 9

On 7/14/2012 1:59 AM, Bruno Luong wrote:
> "yugandhar ch" <yug_0203@rediffmail.com> wrote in message <jtr2b0$ord$1@newscl01ah.mathworks.com>...
>> how to genetate random numbers from a distribution with function
>> F(x) = 1 - e^(-(x-alpha)/theta),
>
> Fantasy question: this is not a valid distribution, since it is not L1-integrable.
>

I was not sure what he wrote above, if the it the pdf or the cdf or
what. But It looks now like the complementary CDF. i.e. 1-F(x), where
F(x) is the CDF.

If so, then the CDF is
   
          e^(-(x-alpha)/theta)

and the pdf is just the derivative of the above, which is itself.

And the above, for positive theta is integrable, but only for
assume x>=0 and theta>0.

Now, I am not good in probability, (was lucky to pass
my probability course) but there are pdf's defined
for finite support.

So, may be this is one of those pdf's. i.e. for x=0..infinity

Either way, if it ends up to be a valid pdf, the method
of inverse CDF can be used to generate random numbers from
it using the uniform distribution.

--Nasser

Subject: random numbers

From: Nasser M. Abbasi

Date: 14 Jul, 2012 07:30:33

Message: 5 of 9

On 7/14/2012 2:26 AM, Nasser M. Abbasi wrote:

>
> If so, then the CDF is
>
> e^(-(x-alpha)/theta)
>
> and the pdf is just the derivative of the above, which is itself.
>


opps, the derivative is itself over the derivative of the power, i.e.

    e^(-(x-alpha)/theta)/(-theta)

(which is integrable for x=0..infinity,theta>0)

--Nasser

Subject: random numbers

From: Bruno Luong

Date: 14 Jul, 2012 11:16:14

Message: 6 of 9

"Nasser M. Abbasi" <nma@12000.org> wrote in message <jtr76p$c3m$1@speranza.aioe.org>...
>
> e^(-(x-alpha)/theta)/(-theta)
>
> (which is integrable for x=0..infinity,theta>0)
>

Bravo, you have just discovered a negative probability density. ;-)

Bruno

Subject: random numbers

From: yugandhar ch

Date: 16 Jul, 2012 08:12:07

Message: 7 of 9

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <jtr5d2$5aj$1@newscl01ah.mathworks.com>...
> "yugandhar ch" <yug_0203@rediffmail.com> wrote in message <jtr2b0$ord$1@newscl01ah.mathworks.com>...
> > how to genetate random numbers from a distribution with function
> > F(x) = 1 - e^(-(x-alpha)/theta),
>
> Fantasy question: this is not a valid distribution, since it is not L1-integrable.
>
> Bruno
you are write bruno,actually it is the cdf of shifted exponential distribution whose pdf is
f(x)=(1/theta)*exp(-(x-alpha)/theta),alpha<= x<=inf.
now,can you help me.
thanks.

Subject: random numbers

From: Torsten

Date: 16 Jul, 2012 08:33:39

Message: 8 of 9

On 16 Jul., 10:12, "yugandhar ch" <yug_0...@rediffmail.com> wrote:
> "Bruno Luong" <b.lu...@fogale.findmycountry> wrote in message <jtr5d2$5a...@newscl01ah.mathworks.com>...
> > "yugandhar ch" <yug_0...@rediffmail.com> wrote in message <jtr2b0$or...@newscl01ah.mathworks.com>...
> > > how to genetate random numbers from a distribution with function
> > > F(x) = 1 - e^(-(x-alpha)/theta),
>
> > Fantasy question: this is not a valid distribution, since it is not L1-integrable.
>
> > Bruno
>
> you are write bruno,actually it is the cdf of shifted exponential distribution whose pdf is
> f(x)=(1/theta)*exp(-(x-alpha)/theta),alpha<= x<=inf.
> now,can you help me.
> thanks.

r=alpha-theta*log(1-rand(n))

Best wishes
Torsten.

Subject: random numbers

From: Torsten

Date: 16 Jul, 2012 11:31:07

Message: 9 of 9

On 16 Jul., 10:33, Torsten <Torsten.Hen...@umsicht.fraunhofer.de>
wrote:
> On 16 Jul., 10:12, "yugandhar ch" <yug_0...@rediffmail.com> wrote:
>
> > "Bruno Luong" <b.lu...@fogale.findmycountry> wrote in message <jtr5d2$5a...@newscl01ah.mathworks.com>...
> > > "yugandhar ch" <yug_0...@rediffmail.com> wrote in message <jtr2b0$or...@newscl01ah.mathworks.com>...
> > > > how to genetate random numbers from a distribution with function
> > > > F(x) = 1 - e^(-(x-alpha)/theta),
>
> > > Fantasy question: this is not a valid distribution, since it is not L1-integrable.
>
> > > Bruno
>
> > you are write bruno,actually it is the cdf of shifted exponential distribution whose pdf is
> > f(x)=(1/theta)*exp(-(x-alpha)/theta),alpha<= x<=inf.
> > now,can you help me.
> > thanks.
>
> r=alpha-theta*log(1-rand(n))
>
> Best wishes
> Torsten.

Or better:
r=alpha-theta*log(1-rand(n,1))
gives you an (nx1)-vector r of random numbers which follow your above
pdf.

Best wishes
Torsten.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us