If you go just past the boundaries on your grid it works:
x = linspace(0.9, 2.1, n); y = linspace(-0.1, 1.1, n); z = linspace(-0.1, 1.1, n);