double integral in MATLAB, limits as variable?

50 views (last 30 days)
Amit Kumar
Amit Kumar on 20 Nov 2013
Answered: madhan ravi on 6 Jul 2018
Hi, Is it possible to do a double integral in MATLAB numerically, where limits are functions of variables?
Say my integrand is x*y dy * dx
limits are y=0 to 5x
x = 0 to 5
I can manage this by
syms x y
But, I think, this is clumsy way. This will get worse for triple integrals. Is there any direct function where we can put limits directly with limits even including variables?

Answers (1)

madhan ravi
madhan ravi on 6 Jul 2018
fun = @(x,y) x.*y;
xmin = 0;
xmax = 5;
ymin = 0;
ymax = @(x) 5*x;
Q = integral2(fun,xmin,xmax,ymin,ymax,'Method','tiled')

Community Treasure Hunt

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

Start Hunting!