I am trying to calculate a double integral with three varibales in the form of a vector AB and another scalar B also as a paremeter. If I write the routine so that AB and B are inside the integration fucntion:
Inty3=integral2(@Func3,0,1,0,@(y) y)function fy3 = Func3(z,y) AB=[1 2 3]; BB=1; fy0=sqrt((AB(1)*z+AB(2)).^2+(BB*z+AB(3)).^2); fyy=((1+fy0).^2)./(1-fy0); % F(y) in Eq.17
fAy=(AB(1)*z+AB(2))./(1-fy0); fy3=fyy.*fAy; end
the integral is clauclated without a problem, but if AB and B are moved outside of Fun3, i.e.,
AB=[1 2 3]; BB=1; Inty3=integral2(@Func3,0,1,0,@(y) y) function fy3 = Func3(z,y) fy0=sqrt((AB(1)*z+AB(2)).^2+(BB*z+AB(3)).^2); fyy=((1+fy0).^2)./(1-fy0); % F(y) in Eq.17 fAy=(AB(1)*z+AB(2))./(1-fy0); fy3=fyy.*fAy; end
then I receive the following error message:
Not enough input arguments.Error in DoubleInt>Func3 (line 15) fy0=sqrt((AB(1)*z+AB(2)).^2+(BB*z+AB(3)).^2);Error in integral2Calc>integral2t/tensor (line 228) Z = FUN(X,Y); NFE = NFE + 1;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 DoubleInt (line 10)Inty3=integral2(@Func3,0,1,0,@(y) y)
Best Answer