Solving integral using matlab

20 ビュー (過去 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 Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by