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

Home » Public Forums » archive » Convolution
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: convolution [message #60415 is a reply to message #26609] Mon, 12 May 2008 19:31 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sarah writes:

> x=make_array(1024)
> sigma=15
> mu =15
> const=1/(sigma*sqrt(2*!pi))
> for i = 0,1024 do x[i]= array[0,*]
> f= const*( EXP(-1.0*(x - mu)^2/(2*sigma^2)))
>
> z = convol(array,array2,/center)
> z = z*2
> print,f
> end
>
> here is the message I get:% Out of range subscript encountered: X.
> % Execution halted at: CONV1 29
> /Users/Dave/Desktop/conv1.pro
> % $MAIN$
>
> I don't see why this doesn't work? I am very frustrated

The problem is on this line:

for I = 0,1024 do x[I]= array[0,*]

0 to 1024 is 1025 numbers. (Count them if you
don't believe me.) But X is only big enough to
hold 1024 numbers, so you are, uh, going out
of its subscript range, as the error message
suggests.

But this line of code is completely unnecessary.
Simply typing this is enough:

x = Reform(array[0,*])

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to export programmatically a volume with IVOLUME to images
Next Topic: Re: Least square fitting

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

Current Time: Sun Nov 30 04:30:24 PST 2025

Total time taken to generate the page: 0.96390 seconds