Question regards double integral

조회 수: 3 (최근 30일)
Samious
Samious 2014년 3월 29일
답변: Roger Stafford 2014년 3월 29일
Hey I have a problem with double integral
this is my function
xmin=0;
xmax=1;
ymin=0;
ymax=x;
ymin<y<ymax;
xmin<x<xmax
F=((y^3)/(x^2+y^2));
a=integral2(F,ymin,ymax,xmin,xmax);
But there seems to be a problem with ymax, I keep getting an error saying undefined function or variable of x
ymax=x
By the way, I want to integrate y first then x

답변 (1개)

Roger Stafford
Roger Stafford 2014년 3월 29일
Writing "ymax=x;" doesn't do the job. If 'ymax' is not a scalar value, it needs to be a 'function handle'. The same applies to the integrand function "F=((y^3)/(x^2+y^2));".
Note also that your integration limits are in backwards order. To integrate w.r. y first and then x, you need to write:
a=integral2(F,xmin,xmax,ymin,ymax);
That is the way 'integral2' is defined.
You can read about these requirements at:
http://www.mathworks.com/help/matlab/ref/integral2.html
and function handles at:
http://www.mathworks.com/help/matlab/function-handles.html

카테고리

Help CenterFile Exchange에서 Install Products에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by