Integration of two exponential functions

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.. :)

5 commentaires

Star Strider
Star Strider le 3 Avr 2017
No attached picture.
Jan
Jan le 3 Avr 2017
I cannot read the formula. Is this "a/b" and all we know is a+b=1?
Michael Henry
Michael Henry le 3 Avr 2017
Hello Jan, Thank you so much for your concerning.
i) You are right! Its a / b.
ii) a+b = 1.
iii) \lambda is the parameter of exponential pdf and it must be > 0 as it represents the rate.
Thanks again..
Hi sharief, This doesn't look like a very tractable integral, but at least it's not oscillatory. If you make the substitution x -> x/b, dx -> dx /b then you end up with
C = (1/b) Integral{0,inf} exp((ay/b)/(1+x)) exp(-(lambda/b)x) dx
so this is really just a two-parameter integral, a function of ay/b and lambda/b. That's not so bad, so one approach would be to make a 2-d table by numerical integration and interpolate off of it, not forgetting to multiply by 1/b afterwards.
Michael Henry
Michael Henry le 3 Avr 2017
Hello David.
I am really thankful for your idea. However, I am not interested in the value of integral itself. Actually, the next thing I am gonna do after this integration is to optimize a and b. Hence, what I am really interested at is to get a closed form for this integration. Can you please tell me if there is any way that I can use MATLAB to get a closed form expression for my integration above?

Connectez-vous pour commenter.

 Réponse acceptée

Star Strider
Star Strider le 3 Avr 2017
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);

6 commentaires

Michael Henry
Michael Henry le 3 Avr 2017
Thank you my friend. I am trying to get a closed form for the integration. Is there anyway that I can do that with MATLAB?
Thank you so much for your time..
Star Strider
Star Strider le 3 Avr 2017
My pleasure.
It does not appear that a closed form analytical solution exists. The Anonymous Function version is the best available option.
Michael Henry
Michael Henry le 3 Avr 2017
Modifié(e) : Michael Henry le 3 Avr 2017
Thanks again, One more thing if you allow me. As MATLAB can't find a closed expression of the solution. How I can plot the integration itself - as it goes from 0 to infinity and has a, b, \lambda, y constants - with respect to x?
Thanks again..
My pleasure.
The easiest way to plot it would be to use the fplot function. Supply values for the parameters as sym variables, for example:
syms b lambda x y
f(x) = exp(((1-b)/b)*y/(b*x+1)) * exp(-lambda*x);
lambda = sym(0.254);
b = sym(0.5);
y = sym(0.42);
fsub = subs(f);
Fsym(x) = int(fsub, x, 0, x);
figure(1)
fplot(Fsym, [0 1E+2])
grid
The fplot function does not allow Inf as an upper limit of the evaluation. However, the function quickly becomes asymptotic depending on the parameter values, so plotting it to infinity may not be necessary. Simply choose a suitably large number to allow the function to reach the asymptote.
Michael Henry
Michael Henry le 4 Avr 2017
Thank you so much for your help. I tried to run the code but I am getting the following errors
"
Error using mupadmex Error in MuPAD command: Can integrate only with respect to identifiers. [int]
Error in symfun/feval>evalScalarFun (line 69) y = mupadmex('symobj::zipargs',Ffun,inds{:});
Error in symfun/feval (line 33) y = evalScalarFun(F.fun, varargin);
Error in fplot (line 101) x = xmin; y = feval(fun,x,args{4:end});
Error in work (line 9) fplot(Fsym, [0 1E+2])
"
Can you please tell me what's wrong? I am sorry for my repeated questions but I am new with MATLAB and I need your experience please. Thank you..
Star Strider
Star Strider le 4 Avr 2017
My pleasure.
I am not certain. The code I posted ran without error. The values of the parameters could be a problem, however I do not know the parameters you provided or the code you ran.

Connectez-vous pour commenter.

Plus de réponses (1)

Michael Henry
Michael Henry le 4 Avr 2017

0 votes

My be the problem with MATLAB version I am using. Can you please tell me which version you are using so I can use it.
Thanks again.

3 commentaires

Star Strider
Star Strider le 4 Avr 2017
I am using R2017a.
Michael Henry
Michael Henry le 4 Avr 2017
Thank you so much. I am able to run the code now with no errors after I downloaded the 2017a version.
Best Regards.
Star Strider
Star Strider le 4 Avr 2017
My pleasure.
I am happy that it works for you.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by