Question regards double integral

2 Ansichten (letzte 30 Tage)
Samious
Samious am 29 Mär. 2014
Beantwortet: Roger Stafford am 29 Mär. 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

Antworten (1)

Roger Stafford
Roger Stafford am 29 Mär. 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

Kategorien

Mehr zu Install Products finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by