How do the limits of integration, H and K, depend on C? The integrand is defined only when -(C+Z) < u < C+Z, so the integral does not make sense if H and K are outside of that interval. In FUN1, you are trying to protect against negative square roots by declaring that FUN1=0 when the term under the square root is negative. This creates a point of discontinuity since lim u->C+Z from the left is -infinity, but from the right is zero (because of your artificial definition).. I think I would try to determine valid values for H and K inside of FUN2 and avoid setting FUN1=0 when the integrand is undefined.
... View more