Trying to solve a double integral with matricies

5 visualizaciones (últimos 30 días)
Dmitri McClane
Dmitri McClane el 12 de Nov. de 2019
Respondida: Walter Roberson el 12 de Nov. de 2019
Hello, so I have this array presented as a matrix. I am trying to solve it using a double integral function, but MATLAB returns me multiple codes, any suggestions?
k1matrix2 = [ (((2818572279544283*x)/268435456 - 2818572279544283/536870912)*(x - 1/2))/4 + (((4831838193504485*x)/536870912 - 4831838193504485/1073741824)*(y - 1/2))/4, (((8053063655840809*x)/268435456 - 8053063655840809/536870912)*(x - 1/2))/4 + (((2818572279544283*x)/268435456 - 2818572279544283/536870912)*(x - 1/2))/4, - (((2818572279544283*x)/268435456 - 2818572279544283/536870912)*(x + 1/2))/4 - (((4831838193504485*x)/536870912 - 4831838193504485/1073741824)*(y - 1/2))/4, - (((8053063655840809*x)/268435456 - 8053063655840809/536870912)*(x + 1/2))/4 - (((2818572279544283*x)/268435456 - 2818572279544283/536870912)*(y - 1/2))/4, (((2818572279544283*x)/268435456 - 2818572279544283/536870912)*(x + 1/2))/4 + (((4831838193504485*x)/536870912 - 4831838193504485/1073741824)*(y + 1/2))/4, (((8053063655840809*x)/268435456 - 8053063655840809/536870912)*(x + 1/2))/4 + (((2818572279544283*x)/268435456 - 2818572279544283/536870912)*(y + 1/2))/4, - (((2818572279544283*x)/268435456 - 2818572279544283/536870912)*(x - 1/2))/4 - (((4831838193504485*x)/536870912 - 4831838193504485/1073741824)*(y + 1/2))/4, - (((8053063655840809*x)/268435456 - 8053063655840809/536870912)*(x - 1/2))/4 - (((2818572279544283*x)/268435456 - 2818572279544283/536870912)*(y + 1/2))/4];
fun1= matlabFunction(k1matrix2(:,1));
fun2= matlabFunction(k1matrix2(:,2));
fun3= matlabFunction(k1matrix2(:,3));
fun4= matlabFunction(k1matrix2(:,4));
fun5= matlabFunction(k1matrix2(:,5));
fun6= matlabFunction(k1matrix2(:,6));
fun7= matlabFunction(k1matrix2(:,7));
fun8= matlabFunction(k1matrix2(:,8));
fun = {fun1,fun2,fun3,fun4,fun5,fun6,fun7,fun8};
double_int= @(func) integral2(func,-0.5,0.5,-0.5,0.5);
dblk12 = cellfun(double_int,fun)
Error using
symengine>@(x)(x.*2.999999991e7-1.4999999955e7).*(x-1.0./2.0).*(1.0./4.0)+(x.*1.04999999685e7-5.24999998425e6).*(x-1.0./2.0).*(1.0./4.0)
Too many input arguments.
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 @(func)integral2(func,-0.5,0.5,-0.5,0.5)

Respuestas (1)

Walter Roberson
Walter Roberson el 12 de Nov. de 2019
fun2 does not happen to involve y. By default matlabFunction generates one input for each variable used, so for fun2 it would generate a function of only one variable; for all of the rest it is generating a function of two variables.
You should use 'vars', [x y] as an option to your matlabFunction call.

Categorías

Más información sobre Loops and Conditional Statements 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!

Translated by