integrate multivariable function with infinity bounds?

1 view (last 30 days)
Ivania Daniela
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);
f2=@(qx,qy,qx1)quadgk(@(qy1)f1(qx,qy,qx1,qy1),-inf,inf);
f3=@(qx,qx1)quadgk(@(qy)f2(qx,qy,qx1),-inf,inf);
f4=@(qx)quadgk(@(qx1)f3(qx,qx1),-inf,inf);
f5=quadgk(@(qx)f4(qx),-inf,inf);
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 quadgk/vadapt (line 250) [fx,too_close] = f(x);
Error in quadgk (line 214) [q,errbnd] = vadapt(@f4,interval);
Error in @(qx,qy,qx1)quadgk(@(qy1)f1(qx,qy,qx1,qy1),-inf,inf)
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 quadgk/vadapt (line 250) [fx,too_close] = f(x);
Error in quadgk (line 214) [q,errbnd] = vadapt(@f4,interval);
Error in @(qx,qx1)quadgk(@(qy)f2(qx,qy,qx1),-inf,inf)
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 quadgk/vadapt (line 250) [fx,too_close] = f(x);
Error in quadgk (line 214) [q,errbnd] = vadapt(@f4,interval);
Error in @(qx)quadgk(@(qx1)f3(qx,qx1),-inf,inf)
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 quadgk/vadapt (line 250) [fx,too_close] = f(x);
Error in quadgk (line 214) [q,errbnd] = vadapt(@f4,interval);
Error in sim_solo_fib (line 32) f5=quadgk(@(qx)f4(qx),-inf,inf);*_
Regards

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!