How do I calculate the area under a curve?
6 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Wayne King
on 14 Jun 2013
Edited: Wayne King
on 14 Jun 2013
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.
More Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!