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

Home » Public Forums » archive » Re: A question about Gaussian distributions in IDL
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: A question about Gaussian distributions in IDL [message #44636 is a reply to message #44634] Wed, 29 June 2005 19:14 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <1120080420.668477.173460@z14g2000cwz.googlegroups.com>,
"ntigris@gmail.com" <ntigris@gmail.com> wrote:

> Hello,
>
> IDL's RANDOMN function creates a normal distribution with a mean of 0
> and a variance of 1. I need a variance other than one. Is there a
> simple way to obtain such a distribution in IDL?
>
> Thanks a lot!

Multiply the result of RANDOMN by the desired standard deviation.

Cheers, Ken Bowman


IDL> n = 100000
IDL> x = RANDOMN(seed, n)
IDL> print, stdev(x)
1.00107
IDL> var = 9.0
IDL> std = sqrt(var)
IDL> print, stdev(std*x)
3.00322
IDL> print, variance(std*x)
% Compiled module: VARIANCE.
% Compiled module: MOMENT.
9.01934
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: mnf and masks
Next Topic: Re: how to stop a procedure in idlwave

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

Current Time: Sat Oct 11 18:36:50 PDT 2025

Total time taken to generate the page: 2.64388 seconds