Double integral of a surface

조회 수: 8 (최근 30일)
Andromeda
Andromeda 2021년 11월 11일
댓글: Andromeda 2021년 11월 11일
The correct answer of the double integral of the surface sqrt(x)-y^2 is 1/7 but the program output is 301/1430. Where have I gonne wrong? See code below
syms x y
format rational
Function = @(x,y) x.^(1/2)-y.^2;
xmin = @(y) y.^4;
xmax = @(y) y.^(1/2);
Double_integral = integral2(Function,0,1,xmin,xmax);
disp(Double_integral)
  댓글 수: 1
Andromeda
Andromeda 2021년 11월 11일
Sure
my functon was supposed to be in the form of @(y,x). @Walter Roberson pointed that out

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2021년 11월 11일
xmin - real number
xmax - real number
ymin - real number | file handle
ymin - real number | file handle
Notice that your function handles are named xmin and xmax suggesting that they are limits on x rather than limits on y. But integral2() requires that the x limits be placed before the y limits, and does not permit function handles for the x limits.
What is the solution? This: exchange your x and y in your function.
format rational
Function = @(y,x) x.^(1/2)-y.^2;
xmin = @(y) y.^4;
xmax = @(y) y.^(1/2);
Double_integral = integral2(Function,0,1,xmin,xmax);
disp(Double_integral)
1/7
  댓글 수: 1
Andromeda
Andromeda 2021년 11월 11일
Hahaha, yes!! Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by