I have been doing the integral of f=(8*x-4)/(4*x^2-4*x+5) with matlab, however, it keeps giving the wrong answer, could you help me spot whether I did something wrong with my codes? Or is it a problem of matlab?
PS: the correct answer should be log(4*x^2−4*x+5)+c, but matlab keeps showing log(x^2 - x + 5/4) (yeah I know that matlab doesn't show "+c", but still, the answer is wrong).

 채택된 답변

Star Strider
Star Strider 2020년 3월 1일

0 개 추천

It appears to be correct, simply simplified:
syms x
f = (8*x-4)/(4*x^2-4*x+5);
fint = int(f)
dfint = diff(fint)
figure
fplot(f, [-10 10])
hold on
fplot(dfint, [-10 10], '--')
hold off
The two plots are the same.

댓글 수: 2

Graciano Ding
Graciano Ding 2020년 3월 1일
Hmmm ok thank you so much
Star Strider
Star Strider 2020년 3월 1일
My pleasure!
If my Answer helped you solve your problem, please Accept it!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 3월 1일

0 개 추천

Log of something multiplied by 4 is equal to log 4 plus log of the something. log 4 is an additive constant and indefinite integrals can have arbitrary additive constants. Therefore both versions are correct.
MATLAB considers division (your proposed 5/4) to be more expensive than multiplication so it prefers the version without the division.

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2020년 3월 1일

답변:

2020년 3월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by