Parameter vectors outside integration function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Saeid
el 30 de Abr. de 2017
Comentada: Star Strider
el 30 de Abr. de 2017
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)
0 comentarios
Respuesta aceptada
Star Strider
el 30 de Abr. de 2017
You need to change your call to ‘Func3’ in the second example:
Inty3=integral2(@(z,y) Func3(z,y,BB,AB),0,1,0,@(y) y)
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Computations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!