Question regards double integral

1 visualización (últimos 30 días)
Samious
Samious el 29 de Mzo. de 2014
Respondida: Roger Stafford el 29 de Mzo. de 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

Respuestas (1)

Roger Stafford
Roger Stafford el 29 de Mzo. de 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

Categorías

Más información sobre Install Products en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by