Found a strange thing, while coding numerical integration for a custom function. The MATLAB manual says:
integral3 calls integral to integrate over xmin ≤ x ≤ xmax. It calls integral2 with the 'tiled' method to evaluate the double integral...
I've done proper (I think it is) vectorization of my function, so it takes a tiled input from integral3 and returns a proper array of values. Integration passes without errors, but the NaN value is returned by integration (although the integrated function itself always returns an array of complex numbers).
Along with that if I use integral (with 'ArrayValued' method) of integral2 (tiled method) of the same function, as the manual says integral3 does, the returned values are non-NaN, but complex numbers.
Any idea, where NaN's may come from?
integral3(@(x,y,z) F(x,y,z),x1,x2,y1,y2,z1,z2)
tointegral3(@(z,x,y) F(x,y,z),z1,z2,x1,x2,y1,y2)
– Mike