Discrete Convolution in Euler Math Toolbox

I did a search for discrete convolution functions in EMT, and there is no function with the letters ‘conv’ in them that I could find.  Matlab has the function conv(a,b) to perform convolution on two vectors a and b. The function deconv(a,b) in Matlab performs deconvolution. My college textbook Introduction to Applied Mathematics by Gilbert Strang indicates that discrete convolution is essentially polynomial multiplication.

Fortunately EMT has the function polymult(a,b) which does the same thing as conv(a,b) in Matlab, and polydiv(a,b) does the same thing as deconv(a,b) in Matlab.

2 thoughts on “Discrete Convolution in Euler Math Toolbox

  1. Rene Grothmann

    You are right, polymult() does the same.

    But in fact, for large vectors this is not the fastest way to go. It is faster to do a FFT of both polynomials (padded with zeros), multiply the results, and do an inverse FFT. I have put this into a function, which I should add into EMT.

    [1, 4, 10, 16, 22, 28, 34, 40, 46, 52, 47, 30]
    >function fftconv (a,b) ...
    $a1=zeros(1,n); a1[1:cols(a)]=a;
    $b1=zeros(1,n); b1[1:cols(b)]=b;
    $return real(ifft(fft(a1)*fft(b1)))[1:cols(a)+cols(b)-1];
    [1, 4, 10, 16, 22, 28, 34, 40, 46, 52, 47, 30]

  2. Rene Grothmann

    Upon tests of this i discovered are numerical issues for larger vectors, and it is not faster as implemented above. So maybe it is better to use polymult(). The recent version of EMT can define aliases, which might be a good idea for conv().

Comments are closed.