comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Normal Distributed Random Numbers
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Normal Distributed Random Numbers [message #26517] Tue, 04 September 2001 14:34 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
"Kay Bente" <KBente@lycos.de> writes:

> Hi
> I have to create arrays with normal distributed random numbers, but with
> variable FWHM (Full width half max/standard deviation sigma?).
> I want to add normal distributed noise to an image, so that the values
> differ around a mean value.
> In IDL there is a procedure to create such arrays RandomN, but you can't
> change the FWHM and I can't find what FWHM the normal distribution there
> has.

> So I would be glad If somone can tell me how to create such arrays (maybe
> outof uniform distributed arrays created with RandomU, I have no idea.
> I'm using IDL 5.4

The RANDOMN() function creates a Gaussian distribution with an average of 0,
and a standard deviation of 1. Mathematically, this is written as

EXP(-0.5*X^2)

If you want a different distribution, e.g. a different average or a different
standard deviation, all you need to do is something

RanVals = AvgVal + Sigma*RANDOMN(Seed, Num)

For example,

RanVals = 500 + 3*RANDOMN(Seed, 10000)

would produce a bunch of random numbers with an average value of 500, and a
standard deviation of 3. In other words, most of the numbers would be between
497 and 503.

(The FWHM of this distribution is 2*Sigma*SQRT(2*ALOG(2)), or about 2.35*Sigma,
but I suspect you're really thinking about the standard deviation Sigma rather
than the FWHM.)

William Thompson
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Normal Distributed Random Numbers
Next Topic: Speed penalty using START and COUNT with HDF_SD_GETDATA

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:52:28 PDT 2025

Total time taken to generate the page: 0.00406 seconds