Re: Discrete Convolution
- To: mathgroup at smc.vnet.net
- Subject: [mg18974] Re: Discrete Convolution
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 3 Aug 1999 13:44:27 -0400
- Organization: Universitaet Leipzig
- References: <7nrddv$i60@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Alister, In[1]:= ?ListConvolve "ListConvolve[ker, list] forms the convolution of the kernel ker with list. \ ListConvolve[ker, list, k] forms the cyclic convolution in which the kth \ element of ker is aligned with each element in list. ListConvolve[ker, list, \ {kL, kR}] forms the cyclic convolution whose first element contains list[[1]] \ ker[[kL]] and whose last element contains list[[-1]] ker[[kR]]. \ ListConvolve[ker, list, klist, p] forms the convolution in which list is \ padded at each end with repetitions of the element p. ListConvolve[ker, list, \ klist, {p1, p2, ... }] forms the convolution in which list is padded at each \ end with cyclic repetitions of the pi. ListConvolve[ker, list, klist, \ padding, g, h] forms a generalized convolution in which g is used in place of \ Times and h in place of Plus. ListConvolve[ker, list, klist, padding, g, h, \ lev] forms a convolution using elements at level lev in ker and list." in Mathematica 4.0 Hope that helps Jens Alister McAlister wrote: > > I want a function that mimics Matlab's "conv" function for doing a discrete > convolution of two lists. > > CONV Convolution and polynomial multiplication. > C = CONV(A, B) convolves vectors A and B. The resulting > vector is length LENGTH(A)+LENGTH(B)-1. > If A and B are vectors of polynomial coefficients, convolving > them is equivalent to multiplying the two polynomials. > > I wrote the following, but is there a way of either of > (1) speeding up the code by changing the algorithm ... > ignoring simple things like the multiple evaluations > of Length and so forth which I have left > in only for what I hope is clarity; or > (2) Using a built in function (possibly connected with polynomials) to do > the same thing? > > Mark R Diamond