MATLAB: Solve double integral using ‘integral2’

integralMATLAB

Suppose I have this surface integral:
I use integral2 to solve the double integral but the result has complex number in it
My codes are:
syms x y z
format rat
x=sqrt(1-y.^2-z.^2)
xy=diff(x,y)
xz=diff(x,z)
dS = sqrt(100 + xy.^2 + xz.^2)
fun1 = subs((x+y+z).*dS)
f = matlabFunction(fun1)
Myz = integral2(f,0,10,0,@(y)sqrt(100-y.^2))
And the answer
f =
@(y,z)(y+z+sqrt(-y.^2-z.^2+1.0)).*sqrt(-y.^2./(y.^2+z.^2-1.0)-z.^2./(y.^2+z.^2-1.0)+1.0e2)
Warning: Reached the maximum number of function evaluations (10000). The result fails the global error test.
> In integral2Calc>integral2t (line 129)
In integral2Calc (line 9)
In integral2 (line 106)
In Untitled3 (line 18)
Myz =
139388/21 +97492/19i
What's the problem guys ? Thank you

Best Answer

y = sqrt(100-x^2-z^2) or y = -sqrt(100-x^2-z^2)
->
I = integral_{x=0}^{x=10} integral_{z=0}^{z=sqrt(1-x^2)} (x+sqrt(100-x^2-z^2)+z)*sqrt(1+x^2/(100-x^2-z^2)+z^2/(100-x^2-z^2)) dz dx +
integral_{x=0}^{x=10} integral_{z=0}^{z=sqrt(1-x^2)} (x-sqrt(100-x^2-z^2)+z)*sqrt(1+x^2/(100-x^2-z^2)+z^2/(100-x^2-z^2)) dz dx =
integral_{x=0}^{x=10} integral_{z=0}^{z=sqrt(1-x^2)} 2*(x+z)*10/sqrt(100-x^2-z^2) dz dx
In MATLAB:
I = integral2(@(x,z)2*(x+z)*10./sqrt(100-x.^2-z.^2),0,10,0,@(x)sqrt(100-x.^2))
Best wishes
Torsten.