Solving integral using matlab

조회 수: 19 (최근 30일)
Ashis Pandey
Ashis Pandey 2021년 3월 28일
답변: Walter Roberson 2021년 3월 28일
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

답변 (1개)

Walter Roberson
Walter Roberson 2021년 3월 28일
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.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by