Convolution and polynomial multiplication.

conv(x, y)

Arguments

x, y

real or complex vectors.

Details

r = conv(p,q) convolves vectors p and q. Algebraically, convolution is the same operation as multiplying the polynomials whose coefficients are the elements of p and q.

Value

Another vector.

Note

conv utilizes fast Fourier transformation.

See also

Examples

conv(c(1, 1, 1), 1)
#> [1] 1 1 1
conv(c(1, 1, 1), c(0, 0, 1))
#> [1] 3.330669e-17 8.881784e-17 1.000000e+00 1.000000e+00 1.000000e+00
conv(c(-0.5, 1, -1), c(0.5, 0, 1))
#> [1] -0.25  0.50 -1.00  1.00 -1.00