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

Home » Public Forums » archive » Re: 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 #70510 is a reply to message #70509] Fri, 16 April 2010 09:18 Go to previous messageGo to previous message
bala murugan is currently offline  bala murugan
Messages: 23
Registered: April 2010
Junior Member
On Apr 16, 10:10 am, pp <pp.pente...@gmail.com> wrote:
> On Apr 16, 12:49 pm, bala murugan <bala2...@gmail.com> wrote:
>
>> I am new to IDL. This is my first program in IDL. Can somebody point
>> out the errors in my code. I have been struggling to get it right.
>
> If you do not say what you want to do, and what the problem is, we are
> unlikely to guess it.
>
>> FUNCTION poissondist,fLambda,N
>>         r = RANDOMU(SEED,1)
>>         FOR j=1,N,1 DO BEGIN
>>                 x=poisson(j,fLambda)
>>                 if (x EQ r) THEN a[i]=j
>>         ENDFOR
>> RETURN,a
>> END
>
> a is never defined, which would cause an error when you try to do
> a[i]=j. However, you seem to avoid this occurring with a condition
> that looks like may never happen (x eq r).

My aim is to do the following,

To write 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).

My subroutine/program will look something like this...

piSamples = PoissonDist(fLambda, N)
piSamples = vector of N integer samples returned by the routine
fLambda = mean of the Poisson distribution
N = number of samples to generate

This routine will need to loop n = 1..N Each time through the loop,
it will need to call RANDOMU to get a random number between 0.0 and
1.0. It will then need to call IMSL_POISSONCDF (probably repeatedly)
to determine which integer in the Poisson distribution corresponds to
the random number gotten from RANDOMU. This integer is then placed in
the output vector, etc.

I am not using IMSL_POISSONCDF. Rather I am calculating the poisson
probability myself.

Can you please help me with this?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: GridData Conundrum
Next Topic: Comparison operators and floating-point errors

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

Current Time: Wed Oct 08 14:11:55 PDT 2025

Total time taken to generate the page: 0.00230 seconds