MATLAB: Integration of two exponential functions

integrationnumerical integration

Hello my friends, I have a problem with solving the following integral. It is a combination of two exponentials with different ratio in the attached picture.
I will be very grateful if you can help me with this. The derivation steps, if provided, will be much better to me as I have to apply this kind of integration in other problems I have.
If there is no closed form, can you please help me on how to integrate it using MATLAB with constants a, b, \lambda, and y to appear in the last answer.
Thanks in advance.. 🙂

Best Answer

There does not appear to be an analytical solution. Constraining ‘a+b=1’ simply requires defining ‘a=1-b’, since ‘a’ only appears once.
This seems the best you can do:
syms b lambda x y
f(x) = exp(((1-b)/b)*y/(b*x+1)) * exp(-lambda*x);
F = int(f, x, 0, Inf);
F_fcn = matlabFunction(simplify(F,'Steps',10))
F_fcn =
function_handle with value:
@(b,lambda,y)integral(@(x)exp(-lambda.*x).*exp(-(y.*(b-1.0))./(b.*(b.*x+1.0))),0.0,Inf)
or more directly:
F_fcn = @(b,lambda,y) integral(@(x)exp(-lambda.*x).*exp(-(y.*(b-1.0))./(b.*(b.*x+1.0))),0.0,Inf);