Solving integral using matlab

21 visualizaciones (últimos 30 días)
Ashis Pandey
Ashis Pandey el 28 de Mzo. de 2021
Respondida: Walter Roberson el 28 de Mzo. de 2021
i need to find a percentage error between 1) and 2)
1) finding integral using "int" function (numerical result) i was able to run it easily using
fun = @(x) (exp(x)./(10*x-1));
Q2 = vpa (integral(fun, 0, 200))
BUT, when i did
2) finding integral using symbolic math tool box (exact value), I GOT X2 =NaN
syms x
X2 = vpa(int(exp(x)./(10*x-1),0,200))
MY QUESTION IS: WHY NaN
here is the picture of a question

Respuestas (1)

Walter Roberson
Walter Roberson el 28 de Mzo. de 2021
The denominator of the function has 10*x-1 . The range of x values passes through 1/10, at which point 10*(1/10) - 1 = 1 - 1 = 0. Therefore the function passes through exp(1/10)/0 . From below, 10*x-1 is negative, so from below it approaches negative infinity as x gets closer to 1/10, and from above 10*x-1 is positive, so it approaches positive infinity from the right of x = 1/10.
So... you have a classical non-removal discontinuity, and there is no Cauchy Principal Value available either. So the integral is undefined, which MATLAB signals to you as NaN.

Community Treasure Hunt

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

Start Hunting!

Translated by