Question regards double integral

3 views (last 30 days)
Samious
Samious on 29 Mar 2014
Answered: Roger Stafford on 29 Mar 2014
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

Answers (1)

Roger Stafford
Roger Stafford on 29 Mar 2014
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

Categories

Find more on Install Products in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!