Learn R Programming

dSTEM (version 2.0-1)

conv: Compute convolution function using FFT

Description

Compute convolution function using FFT, similar to 'conv' in matlab

Usage

conv(u, v, shape = c("same", "full"))

Value

a vector of convolution, as specified by shape.

Arguments

u

numerical vector

v

numerical vector, don't need to have the same length as u

shape

if 'same', return central part of the convolution and has the same size as u; otherwise return the whole sequence of size \(lenth(u)+length(v)-1\).

References

Matlab document on 'conv': https://www.mathworks.com/help/matlab/ref/conv.html

Examples

Run this code
u = c(-1,2,3,-2,0,1,2)
v = c(2,4,-1,1)
w = conv(u,v,'same')

Run the code above in your browser using DataLab