I want to calculate a convolution in Matlab where the I declare the functions inside the script file. MWE is
a = 0.9; b = 0.5;
X = @(t) exp(-(b*t).^2);
Y = @(t) exp(-a*b*t.^2);
Z = convnfft(X,Y,'same'); % this is how you usually do convolution when t=linspace(-20,20,1000)
my_integral = integral(Z,-Inf,Inf)
I am using this convolution routine taken from the MathWorks website.
Are there any efficient Matlab convolution routines/programs that can convolve the X
and Y
functions? If I explicitly calculate the convolution integral using symbolic math, it takes so long for these MWE X
and Y
, and it will take even longer to calculate my actual functions.
My goal is to integrate the result of convolution from -Inf
to Inf
.