I'm attempting to evaluate this integral (and equation) where 'a' and 'x' are just inputs, and x' is (x,y,z). also: x will have the form [a,b,c]. In my 'int_func' below, I have taken the dot product of the transpose and the original, to yield the ^2 power that is observable below, for example in: (X(:,1)-x).^2
The code I have so far is:
int_func = @(x,y,z) func([x,y,z]).*exp((-3/(2*a^2)).*((X(:,1)-x).^2 + (X(:,2)-y).^2 + (X(:,3)-z).^2));
val = integral3(int_func,-inf,inf,-inf,inf,-inf,inf);
disp(val * (3/(2*pi*a^2))^(3/2));
where:
X = [0, 0, 0];
a = 1;
With this code, I should be getting an answer of 0.0370, but instead I am getting 0.5556
Can someone suggest another form of evaluating this integral or spot what is wrong with what I have listed?
Best Answer