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 lognormally distributed numbers

Subject: Random lognormally distributed numbers

From: Zeeshan

Date: 20 Oct, 2010 05:56:06

Message: 1 of 3

Hi

This might be very basic question for most of you.
I just wants to generate 100 random numbers between 0 and 1 which are lognormally distributed having particular value of mean and standard deviation.

Subject: Random lognormally distributed numbers

From: Carl

Date: 20 Oct, 2010 08:02:04

Message: 2 of 3

"Zeeshan " <zeeextra@yahoo.com> wrote in message <i9m09m$bb7$1@fred.mathworks.com>...
> Hi
>
> This might be very basic question for most of you.
> I just wants to generate 100 random numbers between 0 and 1 which are lognormally distributed having particular value of mean and standard deviation.

Look at the function lognrnd:

doc lognrnd

This will tell you all about creating random log normal numbers including how to convert the mean and stdev of your distribution to the parameters required.

A lognormal distribution always has a range of 0 in inf so I am not sure what you meant by a range of between 0 and 1.

Do you want to just ignore values over one (and possible get extra random variables so you have 100. This is straight forward but this truncated distribution will have a lower mean than the mean and different stdev of the underlying lognormal (that you entered as a parameter.

If you want a truncated distribution with the mean and standard deviation you specify you will probably need to adopt an iterative approach to get the mean ans stdev of the underlying lognormal (in which case you probably want to sample more than 100 while estimating your parameters and then taking a final sample of 100 once your parameters are acurate enough for you).

Subject: Random lognormally distributed numbers

From: TideMan

Date: 20 Oct, 2010 09:36:48

Message: 3 of 3

On Oct 20, 9:02 pm, "Carl " <carl.me...@sse.com> wrote:
> "Zeeshan " <zeeex...@yahoo.com> wrote in message <i9m09m$bb...@fred.mathworks.com>...
> > Hi
>
> > This might be very basic question for most of you.
> > I just wants to generate 100 random numbers between 0 and 1 which are lognormally distributed having particular value of mean and standard deviation.
>
> Look at the function lognrnd:
>
> doc lognrnd
>
> This will tell you all about creating random log normal numbers including how to convert the mean and stdev of your distribution to the parameters required.
>
> A lognormal distribution always has a range of 0 in inf so I am not sure what you meant by a range of between 0 and 1.  
>
> Do you want to just ignore values over one (and possible get extra random variables so you have 100.  This is straight forward but this truncated distribution will have a lower mean than the mean and different stdev of the underlying lognormal (that you entered as a parameter.
>
> If you want a truncated distribution with the mean and standard deviation you specify you will probably need to adopt an iterative approach to get the mean ans stdev of the underlying lognormal (in which case you probably want to sample more than 100 while estimating your parameters and then taking a final sample of 100 once your parameters are acurate enough for you).

Of course, this assumes you have the Statistics Toolbox.
If you don't, look for randraw in the File Exchange.

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