Hello everyone
I want to numerically integrate a function
1-x^2-y^2
Where x^2+y^2<=1 circular area
What I tired so far is First try:
quad2d(@(x,y) 1-x^2-y^2, -1,1,-1,sqrt(1-x^2))
Second try:
syms x y
int(int(1-x^2-y^2,y, -1,sqrt(1-x^2))x,-1,1)
How can I use sqrt(1-x^2) as the boundary of the integral for y?
I know this can be done with r and theta but I want to calculate the integral by cartesian coordinates.
Could someone offer a solution?

 채택된 답변

Roger Stafford
Roger Stafford 2014년 9월 26일
You need to make the integration limit sqrt(1-x^2) a function handle. See the documentation at
http://www.mathworks.com/help/matlab/ref/quad2d.html
In particular note where it says "q = quad2d(fun,a,b,c,d) approximates the integral of fun(x,y) over the planar region and fun is a function handle, c and d may each be a scalar or a function handle."

댓글 수: 1

it did not work yet, you have dblquad function?
f=@(x,y) 1-(x.^2)-(y.^2);
w=@(x) sqrt(1-x.^2);
q=dblquad(f,-1,1,-1,w);

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

추가 답변 (1개)

bogazici guvercin
bogazici guvercin 2014년 9월 26일

0 개 추천

Thanks for the help
The function handle is not working with dblquad somehow but working with quad2d.
Thanks for the help!

카테고리

도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by