Calculating double integrals over a rectangular region without using built in function.

I am trying to create a function that calculates the double integral of a function over a rectangular region. I know there is a built in function but i need to create code instead of using built in function.. The test cases im using include f = x*y with 2<x<5 and 0<y<1 with the actual answer being 3 and test case #2 is f = x*y^2 1<x<5 0<y<2 with the actual answer being 64. What i currently have is this but i get the wrong answers.
I was going by this idea presented in a reading i did but im not sure if im missinterpreting whats supposed to be done.

回答 (1 件)

DGM
DGM 2021 年 4 月 13 日

0 投票

Your code looks like it should work. The problem is in your assumptions. The double integral over the given area calculates a volume. The volume under f=x*y over the given region isn't 3, it's 5.25. The volume under the second function over its region is 32. For N=1000, the estimate is reasonably close.

2 件のコメント

Andy Valle
Andy Valle 2021 年 4 月 13 日
Ahh i see now then, i was after this in particular, how should i modify my code?
DGM
DGM 2021 年 4 月 13 日
Just change the integration limits that you're passing to the function.

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

カテゴリ

ヘルプ センター および File ExchangeImage Processing Toolbox についてさらに検索

製品

リリース

R2019b

質問済み:

2021 年 4 月 13 日

コメント済み:

DGM
2021 年 4 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by