They’re not 'ArrayValued' in the sense integral understands, and only integral — and not integral2 — can handle array-valued arguments. Otherwise, you could just use integral twice, the second time on the result of the first.
They’re also essentially independent of each other, so integrate them individually using integral2 and then put them together in a matrix at the end.
Specifically:
f = @(x,y)x+y;
g = @(x,y)x.^2+y.^2;
h = @(x,y)x./y+y./x;
w = @(x,y)sin(x)+cos(y);
intf = integral2(f,1,2,1,2);
intg = integral2(g,1,2,1,2);
inth = integral2(h,1,2,1,2);
intw = integral2(w,1,2,1,2);
answers = [intf intg; inth intw]
answers =
3.0000 4.6667
2.0794 1.0243
Best Answer