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 #70500 is a reply to message #70499] Fri, 16 April 2010 11:59 Go to previous messageGo to previous message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
"bala murugan" <bala2305@gmail.com> wrote in message
news:63998232-09c5-4bf3-a795-b85c5c03b954@r27g2000yqn.google groups.com...
...
CODE:

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
*****************************************

when i becomes equal to N you will get an error
trying to access a[i].
Also, your a[0] is equal to zero.


And, your function is
FUNCTION poissondist, fLambda, N
and you call it like:
x=poisson(j,fLambda)

Note that flambda is in the wrong position.
[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:10:06 PDT 2025

Total time taken to generate the page: 0.00462 seconds