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

Home » Public Forums » archive » Help needed!!
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: Help needed!! [message #70543 is a reply to message #70513] Tue, 20 April 2010 10:43 Go to previous messageGo to previous message
bala murugan is currently offline  bala murugan
Messages: 23
Registered: April 2010
Junior Member
On Apr 19, 12:26 pm, David Fanning <n...@dfanning.com> wrote:
> Craig Markwardt writes:
>> A Poisson deviate is the thing you originally desired!   A single
>> Poisson deviate is one random draw from the Poisson distribution.  A
>> histogram of N deviates will approximate the Poisson distribution, and
>> as N tends to infinity, the histogram will tend to the Poisson
>> distribution exactly.
>
> We shall not cease from exploration
> And the end of all our exploring
> Will be to arrive where we started
> And know the place for the first time.
>
>          From The Four Quartets
>          T.S. Eliot
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thue. ("Perhaps thos speakest truth.")

My objective like I said is as follows,
an IDL routine that takes as input the mean of a Poisson
distribution (fLambda = a floating point number >= 0.0) and a number
of realizations (N), and generates N samples from the Poisson
distribution with mean fLambda. The output samples should be
provided
as a vector (list) of integers (each >= 0).I will also want to plot
a histogram of the samples (IDL probably has a built-in histogramming
routine).

I couldnt make the following work :( (Its just too complicated!!)

FUNCTION poi,fLambda,N
a = FLTARR(N)
FOR i=1,N-1,1 DO BEGIN
r = RANDOMU(SEED,1)
FOR j=1,(5*N),1 DO BEGIN
x = ((fLambda^j)/(exp(fLambda)*factorial(j)))
z=abs(x-r)

if z lt 0.1 THEN a[i]=j & print,r,abs(x-r) & ENDFOR
ENDFOR
RETURN,a
END


Rather I guess the following satisfies my objective,

IDL> data = RANDOMU(SEED,N,POISSON=fLambda)
IDL> PLOT,HISTOGRAM(data,BINSIZE=1),PSYM=10

Where, N- number of realizations
fLambda - mean of the poisson distribution

David,

Can you please check if I am right about the second method?

Thanks,

Thanks to all the guys who replied, I got to learn a lot from your
replies.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Virtual machine popup
Next Topic: Sports Health Insurance and Exclusions

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

Current Time: Wed Oct 08 19:28:55 PDT 2025

Total time taken to generate the page: 0.00236 seconds