# integrate multivariable function with infinity bounds?

1 view (last 30 days)
Ivania Daniela on 28 May 2014
Answered: Mike Hosea on 11 Aug 2014
Hi !
I need to integrate a function with infinity bounds. I try using "quadgk" command but matlab give me many errors.
this is my program
%variables values
a=32;
b=96;
d=64;
sigma=50000;
x=1;
y=1;
%function
int1=@(qx,qy,qx1,qy1) exp(-(sigma^2).*((qx-qx1).^2+(qy-qy1).^2)./4)...
.*exp(1i.*((qx.*x)+(qy.*y)))...
.*exp(1i.*qx1.*d/2).*sinc(qx1.*a./pi).*sinc(qy1.*b./pi);
f1=@(qx,qy,qx1,qy1)int1(qx,qy,qx1,qy1);
And here is the error
_*Error using - Matrix dimensions must agree.
Error in @(qx,qy,qx1,qy1)exp(-(sigma^2).*((qx-qx1).^2+(qy-qy1).^2)./4).*exp(1i.*((qx.*x)+(qy.*y))).*exp(1i.*qx1.*d/2).*sinc(qx1.*a./pi).*sinc(qy1.*b./pi)
Error in @(qx,qy,qx1,qy1)int1(qx,qy,qx1,qy1)
Error in @(qy1)f1(qx,qy,qx1,qy1)
Error in quadgk/evalFun (line 339) fx = FUN(x);
Error in quadgk/f4 (line 386) [y,too_close] = evalFun(tt);
Error in @(qy)f2(qx,qy,qx1)
Error in quadgk/evalFun (line 331) fx = FUN(x);
Error in quadgk/f4 (line 386) [y,too_close] = evalFun(tt);
Error in @(qx1)f3(qx,qx1)
Error in quadgk/evalFun (line 331) fx = FUN(x);
Error in quadgk/f4 (line 386) [y,too_close] = evalFun(tt);
Error in @(qx)f4(qx)
Error in quadgk/evalFun (line 331) fx = FUN(x);
Error in quadgk/f4 (line 386) [y,too_close] = evalFun(tt);
Error in sim_solo_fib (line 32) f5=quadgk(@(qx)f4(qx),-inf,inf);*_
Regards

Mike Hosea on 11 Aug 2014
This is not how to compute a quadruple integral. See, for example, my answer here: