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.
  1 件のコメント
Brian
Brian 2013 年 6 月 15 日
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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