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

Home » Public Forums » archive » Does CONVOL convolute
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Does CONVOL convolute [message #34161] Mon, 24 February 2003 11:01
condor is currently offline  condor
Messages: 35
Registered: January 2002
Member
OK, I'm kinda puzzled here -- can someone explain the following to me
(IDL 5.5 on linux if it makes a difference)?

Let there be a simple symmetric 2D array and a simple symmetric kernel
-- then the result is exactly what I expect:


IDL> tt = fltarr(5,5)
IDL> tt[2,2] = 1
IDL> print,tt
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 1.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
IDL> k = float([[1,2,1],[2,4,2],[1,2,1]])
IDL> print,k
1.00000 2.00000 1.00000
2.00000 4.00000 2.00000
1.00000 2.00000 1.00000
IDL> print,convol(tt,k)
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 1.00000 2.00000 1.00000 0.00000
0.00000 2.00000 4.00000 2.00000 0.00000
0.00000 1.00000 2.00000 1.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000


But leaving the kernel alone, and just making the original array
unsymmetric, I get something entirely unexpected:

IDL> tt = fltarr(5,5)
IDL> tt[0,0] = 1
IDL> print,tt
1.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
IDL> print,convol(tt,k)
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 1.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000

Huh?

I get the same results with or without the /center keyword to convol.

I had some code that relied on the fact that convolution of a non-zero
element in tt cannot result in a zero element in tt if the convolution
kernel is non-zero everywhere. Well, so much for that idea. Can
someone tell me what I'm thinking wrong here?
[Message index]
 
Read Message
Previous Topic: Basil to do...
Next Topic: Re: Plotting to more than one window

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

Current Time: Wed Oct 08 19:15:36 PDT 2025

Total time taken to generate the page: 0.00442 seconds