Question regards double integral

3 次查看(过去 30 天)
Samious
Samious 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 中查找有关 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