I'm trying to evaluate the following integral in matlab: http://i.imgur.com/Iuc4VT5.png
Here is my code:
alpha = 2;
F1 = @(u,v) 2*u.*v.*exp(-u.^2)./(1+2*z.*u.*v);
F2 = @(v) v;
F3 = @(z) exp(-z)./sqrt(z);
I1 = dblquad(F1,0,1e5,2,1e5);
I2 = quad(F2,2,1e5);
quad(F3*exp(-(I2-I1)),0,1e5);
I'm getting the errors shown below. These errors don't show much, but I'm guessing it's because of the way I wrote F1. I defined F1 as a function of u and v for the double integral, but there is also a variable z which is the variable of the outer integral. I did that because there is no way I can separate z from the inner integrals. Is there any better way to write this integration?
Error in ==> @(u,v)2*u.*v.*exp(-u.^2)./(1+2*z.*u.*v)
Error in ==> dblquad>innerintegral at 73
fcl = intfcn(xmin, y(1), varargin{:}); %evaluate only to get the class below
Error in ==> quad at 76
y = f(x, varargin{:});
Error in ==> dblquad at 53
Q = quadf(@innerintegral, ymin, ymax, tol, trace, intfcn, ...
I'm choosing 1e5 to represent infinity.
Undefined function or variable 'z'.- A. DondaF1is not correct, but I don't know of any other way. Any suggestions? - Thomas Jr