# Error "Integrand output size does not match the input size." in implementing double integration. Kindly guide me in eliminating the error.

14 views (last 30 days)
Swathi S on 30 Jul 2019
Commented: Swathi S on 30 Jul 2019
CODE:
a=0.15
d=sqrt(a.^2+a.^2)
M=@(a1,a2)(((((-(sqrt(a1.^2+a2.^2+d)).*a1)-((sqrt(a1.^2+a2.^2+d)).*a2)-(a1.^2)-(a2.^2)).*((sqrt(a1.^2+a2.^2+d))-a1).*((sqrt(a1.^2+a2.^2+d))-a2))+((-(sqrt(a1.^2+a2.^2+d)).*a1+(sqrt(a1.^2+a2.^2+d)).*a2+a1.^2+a2.^2).*((sqrt(a1.^2+a2.^2+d))+a1).*((sqrt(a1.^2+a2.^2+d))-a2))+(((sqrt(a1.^2+a2.^2+d)).*a1+(sqrt(a1.^2+a2.^2+d)).*a2-a1.^2-a2.^2).*((sqrt(a1.^2+a2.^2+d))+a1).*((sqrt(a1.^2+a2.^2+d))+a2))+(((sqrt(a1.^2+a2.^2+d)).*a1-(sqrt(a1.^2+a2.^2+d)).*a2+a1.^2+a2.^2).*((sqrt(a1.^2+a2.^2+d))-a1).*((sqrt(a1.^2+a2.^2+d))+a2)))/((sqrt(a1.^2+a2.^2+d)).*((sqrt(a1.^2+a2.^2+d))+a1).*((sqrt(a1.^2+a2.^2+d))+a2).*((sqrt(a1.^2+a2.^2+d))-a1).*((sqrt(a1.^2+a2.^2+d))-a2)));
Mpq= integral2(M,-0.15,0.15,-0.15,0.15)
ERROR:
Error using integral2Calc>integral2t/tensor (line 241)
Integrand output size does not match the input size.
Error in integral2Calc>integral2t (line 55)
[Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
Error in integral2Calc (line 9)
[q,errbnd] = integral2t(fun,xmin,xmax,ymin,ymax,optionstruct);
Error in integral2 (line 106)
Q = integral2Calc(fun,xmin,xmax,yminfun,ymaxfun,opstruct);
Error in Mtest3 (line 13)
Mpq= integral2(M,-0.15,0.15,-0.15,0.15)

Torsten on 30 Jul 2019