From the documentation of intergral2:
The function fun must accept two arrays of the same size and return an array of corresponding values. It must perform element-wise operations
Your function does not do element wise operation. As a workaround you will have to write up a function file where you can check if one of x or y is a single element and replicate it to be a vector of constants.
