How do I calculate the area under a curve?

조회 수: 6 (최근 30일)
Brian
Brian 2013년 6월 14일
Hi, I'm struggling with this when the upper limit of integration is a function itself.
The question is as follows:
"Calculate the area confined by the functions f(x)=x+3 and g(x)=tan(x) in the first positive interval. From x=0 to the first positive intersection point (where f(x)= g(x))."
Thanks for any help.

채택된 답변

Wayne King
Wayne King 2013년 6월 14일
편집: Wayne King 2013년 6월 14일
The upper limit is not a function, you just have to find where tan(x) is equal to x+3, so your limits of integration are [0, tan(x)=x+3]. You can find this numerically with
uplim = fzero(@(x) tan(x)-x-3,1.2)
Why did I pick 1.2? Because tan(x) "blows up" at pi/2 because cos(pi/2) is zero (the denominator), accordingly, if you look for a zero too close to that discontinuity, you're going to get a bad result.
You can test that the answer return by fzero() is good
tan(uplim)-uplim-3
Now you know the upper limit of integration.

추가 답변 (0개)

카테고리

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