What do you mean when you say you want "the user to enter" the function in your comment?
Do you want the user to have to pass some thing into your function that lets your function call a function of their choosing? If so you want your user to define a function handle (which could be an anonymous function.)
z1 = integral2(f1, 0, 1, 1, 2)
Or do you want to have the user enter the text of a function in say an edit box in a dialog or UI? In that case you should use str2func.
f3 = str2func(['@(x, y)' s]);
z3 = integral2(f3, 0, 1, 1, 2)
Or did you have a different meaning in mind? In this case, please explain what you want to do in more detail.