convolution of 1-D array with a function [message #94227] |
Wed, 01 March 2017 23:55  |
Krishnakumar M.A
Messages: 19 Registered: March 2013
|
Junior Member |
|
|
Hi there,
I was trying to convolve a 1-D array (a Gaussian) with an exponentially decreasing function. I have not used the convol() function in IDL, but will this work for such 1-D arrays, or are there any other functions which does this?
Any help is appreciated.
|
|
|
Re: convolution of 1-D array with a function [message #94229 is a reply to message #94227] |
Thu, 02 March 2017 00:47  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Thursday, March 2, 2017 at 8:55:26 AM UTC+1, Krishnakumar M.A wrote:
> Hi there,
>
> I was trying to convolve a 1-D array (a Gaussian) with an exponentially decreasing function. I have not used the convol() function in IDL, but will this work for such 1-D arrays, or are there any other functions which does this?
>
> Any help is appreciated.
Hi,
I'm not sure about the details, but this looks pretty close to correct convoluting a step function with a gaussian:
x = findgen(101)/10.0-5.0
y = exp(-x*x/2.0)
ps = plot(x,y,'2r', yRange=[-0.05,1.05], name='Gaussian')
yStep = x
yStep[0:50] = 0.0
yStep[51:100] = 1.0
op = plot(x,yStep, '2g', overplot=ps, name='Step function')
yConv = convol(yStep,y, /edge_trunc, /center, /norm)
opc = plot(x,yConv, '2b', overplot=ps, name='convolution')
ll = legend(target=[ps,op,opc], position=[-3.5,0.85], vertical_alignment=0.5, horizontal_alignment=0.5, /data, /auto_text_color)
cheers,
Helder
|
|
|