Learn R Programming

signal (version 1.8-0)

conv: Convolution

Description

A Matlab/Octave compatible convolution function that uses the Fast Fourier Transform.

Usage

conv(x, y)

Value

An array of length equal to length(x) + length(y) - 1. If x and y are polynomial coefficient vectors,

conv returns the coefficients of the product polynomial.

Arguments

x,y

numeric sequences to be convolved.

Author

Original Octave version by Paul Kienzle pkienzle@user.sf.net. Conversion to R by Tom Short.

Details

The inputs x and y are post padded with zeros as follows:

ifft(fft(postpad(x, n) * fft(postpad(y, n))))

where n = length(x) + length(y) - 1

References

Octave Forge https://octave.sourceforge.io/

See Also

convolve, fft, ifft, fftfilt, poly

Examples

Run this code
conv(c(1,2,3), c(1,2))
conv(c(1,2), c(1,2,3))
conv(c(1,-2), c(1,2))

Run the code above in your browser using DataLab