# Convolution of a gaussian and an exponential

18 views (last 30 days)
Lamees Alkiyumi on 27 Sep 2022
Commented: Paul on 27 Sep 2022
Hello,
I am trying to get a fitting equation by calculating the integral of a gaussian with an exponential, however, I am unsure why matlab is giving me results with complex numbers. Any help would be appreciated.
Thanks :)
syms I0 E E0 s N0 a Emax
A = I0*exp(-(E-E0)^2/(2*s^2*pi))
A =
B = N0*exp(-a*E0)
B =
int(A*B,E0,-inf,Emax)
ans =

Paul on 27 Sep 2022
Edited: Paul on 27 Sep 2022
Are all of the parameters in the problem real? If so, then asserting them as such yields a simpler result.
syms I0 E E0 s N0 a Emax real
A = I0*exp(-(E-E0)^2/(2*s^2*pi))
A =
B = N0*exp(-a*E0)
B =
int(A*B,E0,-inf,Emax)
ans =
Why does the Question refer to convolution? Asking because this integral is not a convolution integral, if convolution is really what is desired.
##### 2 CommentsShowHide 1 older comment
Paul on 27 Sep 2022
Hi Lamees,
Using the notation in the linked reference, specifically in equation (3), the definition of convolution is:
given functions a(x) and b(x), their convolution is
c(y) = int(a(x)*b(y-x),x,0,inf) = int(a(y-x)*b(x),x,0,inf)
Note the argument of b in the first instance and of a in the second, and the lmits of integration, which implicitly assume that a(x) = b(x) = 0 for x < 0.
In your case, with x = E0, I think you just did
c(y) = int(a(x)*b(x),x,-inf,Emax)
That is, your equation doesn't do the "flip and slide" of b(x) (or alternatively a(x) ). Not sure what you're assuming for those limits of integration.

### Categories

Find more on Numeric Solvers in Help Center and File Exchange

R2019a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by