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

Home » Public Forums » archive » Convolution, IDL & Numerical Recipes
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, IDL & Numerical Recipes [message #32761 is a reply to message #32678] Fri, 01 November 2002 10:44 Go to previous message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
David Fanning wrote:
> R.G. Stockwell (sorry@noemail.now) writes:
>
>
>> Perhaps you want to use the following keywords:
>> Check out the help file to see the effects the keywords
>> have on how the arrays line up to be convolved.
>> (Note: you must explicitly set center=0, or else it defaults
>> to 1)
>
>
> Alright, now, can you give me the layman's definition
> of the difference between spacial filtering (CENTER=1)
> and convolution "in the strict mathematical sense"
> (CENTER=0).
...

> Cheers,
>
> David

If I may answer quickly off the top of my head without thinking about
it or looking at the help files, then I'd say, .. uh.... hmmm.... oh I
better look it up.

Ok, convol is just about the most messed up piece of code that IDL has.
(Don't get me started about people using the letter "l" as a variable,
which to me is indistinguishable from the number "1").

The difference is quite profound between the two.

IF center = 0 EXPLICITLY, then
you have the sum of A[t-m/2+i] K[i]
NOTE that the index of A is a constant +i, this is a correlation.
The kernel shifts along, and the time series shifts along in the same direction.


IF center = 1 OR is ommitted, then
you have the sum of A[t-i] K[i]
NOTE that the index of A is now a constant - i, this is a convolution.
The kernel shifts along, BUT the time series is shifting backwards (in the opposite direction).

Also, the offsets move around too.



> Which would I use if I'm trying to make a pretty image? :-)

I suggest running all possible permutations of the keywords, and
selecting the one that matches the textbook examples :)




; test code

a = indgen(10)
k = [1,2,3]

print,'_________________'
print,strcompress(string(convol(a,k,center=1)))
print
print,strcompress(string(convol(a,k,center=0)))

<results>

0 8 14 20 26 32 38 44 50 0

0 0 4 10 16 22 28 34 40 46

Note the way the results are not even similar! YAY!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: registering images, shift(/nowrap)
Next Topic: Re: PRINT on same line

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

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

Total time taken to generate the page: 0.00458 seconds