Re: [R] Convolution confusion:

2011-05-18 Thread peter dalgaard
On May 18, 2011, at 15:47 , Alex Hofmann wrote: > Hi, > > I'm new to R, and I'm a bit confused with the "convolve()" function. > If I do: > x<-c(1, 2, 3) > convolve(x, rev(x), TRUE, "open") > = 9 12 10 4 1 > > But I expected: 3 8 14 8 3 (like in Octave/MATLAB - conv(x, reverse(x)) ) > > 3 2 1

[R] Convolution confusion:

2011-05-18 Thread Alex Hofmann
Hi, I'm new to R, and I'm a bit confused with the "convolve()" function. If I do: x<-c(1, 2, 3) convolve(x, rev(x), TRUE, "open") = 9 12 10 4 1 But I expected: 3 8 14 8 3 (like in Octave/MATLAB - conv(x, reverse(x)) ) 3 2 1 x 1 2 3 = 3 2 1 0 6 4 2 0 0 9 6 3 = 3 8 14 8 3 The thing is, t