Here is an example for integral3
According to this integration is done from z to x
You have only y. Looks like x=x(y) in your case
So you have to integrate by x first
Try to replace limits of integration
Phi_ij1 = @(i,j) integral2(@(x,y)B_zi(i,x,y), 0, y_max1(j)), 0, @(y)x_max1(y,j) - ...
integral2(@(x,y)B_zi(i,x,y), y_min1(j),y_max1(j), 0, @(y)x_max1(y,j)) ;