[R] Convolution vector to be derived

Allan Engelhardt allane at cybaea.com
Fri Jun 4 22:09:52 CEST 2010


On the contrary: it is trivial to produce the result.

x <- c(1,2,3,4,5)
y <- c(6,7,8,9)
convolve(x, rev(y), type="open")
# [1]   6  19  40  70 100  94  76  45

Try help("convolve").

Allan


On 04/06/10 19:21, Moohwan Kim wrote:
> Dear R-help,
>
> I want to generate the following outcome using the convolution of two sequences.
>
> x<- c(1,2,3,4,5)
> y<- c(6,7,8,9)
>
> The resulting convolution vector is
> 6
> 19
> 40
> 70
> 100
> 94
> 76
> 45
> When using convolve(), it is hard to produce the result above.
> Would you help me out to get that?
>
>



More information about the R-help mailing list