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 #70479 is a reply to message #70478] Sat, 17 April 2010 07:57 Go to previous messageGo to previous message
jeanh is currently offline  jeanh
Messages: 79
Registered: November 2009
Member
On 16/04/2010 2:06 PM, bala murugan wrote:
> FUNCTION poissondist,fLambda,N
> FOR i=1,N,1 DO BEGIN
> a = FLTARR(N)
> r = RANDOMU(SEED,1)
> FOR j=1,N,1 DO BEGIN
> x=poisson(j,fLambda)
> if abs(x-r) lt 0.0001 THEN a[i]=j
> ENDFOR
> ENDFOR
> RETURN,a
> END

Hi,

you have two more errors here.
First, as you overwrite the array "a" in each "i" loop, you will only
have results for i=N, not for all i. You need to declare "a" before the
first loop.
Second, a[i] will not work when i=N. As you start i at 1, not 0, you
would need to do a[i-1]=j (or a[i-1]=j-1, to be on the same base)

Jean
[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 18:26:52 PDT 2025

Total time taken to generate the page: 0.00518 seconds