How do I calculate the area under a curve?

6 vues (au cours des 30 derniers jours)
Brian
Brian le 14 Juin 2013
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.

Réponse acceptée

Wayne King
Wayne King le 14 Juin 2013
Modifié(e) : Wayne King le 14 Juin 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.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by