I am trying to numerical integrate the function. I am not able to solve it. Can anyone help me?
Note: t is a constant over here and limits are from 0 to x1.
Thanks in advance.
Raj Patel.

6 commentaires

John D'Errico
John D'Errico le 21 Sep 2020
PLease don't insert a picture of code. If it were text, I could just copy your function into MALTAB to look at it. As it is, then I need to retype it, for no good reason. And while this is a simple case, why in the name of god and little green apples would you want to make it more difficult for someone too help you?
John D'Errico
John D'Errico le 21 Sep 2020
Next, is t a known constant? Does it have some value? What is it? If not, then you cannot use integral to integrate a function with a symbolic parameter.
Raj Patel
Raj Patel le 21 Sep 2020
Thank you for pointing that out John. I didn't realise it. But I have copied the code below.
fun = @(x)(1 ./ ((exp(0.014342 / (x * t)) - 1)) .* (1 / (x^4)));
q = integral(@(x) fun(x), 0, x1)
Thanks,
Raj Patel
Raj Patel
Raj Patel le 21 Sep 2020
"t" is an unknown constant. What shall I use to integrate it if I cannot use integral?
Raj Patel
Raj Patel le 21 Sep 2020
I tried using int(function) to solve, but I am still not getting an answer.
Raj Patel
Raj Patel le 21 Sep 2020
I tried using int(function) to solve, but I am still not getting an answer.

Connectez-vous pour commenter.

 Réponse acceptée

John D'Errico
John D'Errico le 21 Sep 2020
If t is unknown, then you need to use symbolic tools to do the integration.
syms x t
K = 1/((exp(0.014342/(x * t)) - 1)) * (1/(x^4));
int(K,x,[0,1])
ans =
int(1/(x^4*(exp(2066900027383925/(144115188075855872*t*x)) - 1)), x, 0, 1)
MATLAB just returns the integral in the form it was given. I tried Wolfram Alpha, which also agrees it cannot find a solution. There is no assurance that anything you write down has a nice closed form solution.
You have some options. If you had some value for t, then we could write it as:
Kxt = @(x,t) 1./((exp(0.014342./(x * t)) - 1)) .* (1./(x.^4));
foft = @(t) integral(@(x) Kxt(x,t),0,1);
foft(3)
ans =
22003287.386445
foft(1.2)
ans =
1408175.40694754
So while no analytical form is available, we can find a numerical solution. I could have used vpaintegral too.
Finally, you could probably write the problem as a series expansion, but then you would need to consider the domain of convergence, etc.

1 commentaire

Raj Patel
Raj Patel le 21 Sep 2020
Thank you John. I appreciate your effort and time.

Connectez-vous pour commenter.

Plus de réponses (1)

Alan Stevens
Alan Stevens le 21 Sep 2020

0 votes

Need to write fun as
fun = @(x) (1./(exp(0.014342./(x*t))-1).*1./x.^4);

Community Treasure Hunt

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

Start Hunting!

Translated by