x = [-1:0.2:1]; y = x; [X, Y] = meshgrid(x, y); Z = sqrt(1 - X.^2 - Y.^2); Z(1,1) mesh(X, Y, Z) quiver(X, Y, real(Z), imag(Z), '-') axis([-1.25 1.25 -1.25 1.25]) mesh(X, Y, real(Z)) keep = (imag(Z) == 0); Zr = Z.*keep; mesh(X, Y, Z.*((imag(Z) == 0))) I = imag(Z) > 0; Z(I) = NaN; mesh(X, Y, Z) Z(6,6) = NaN; mesh(X, Y, Z) a = [0:pi/4:2*pi]; r = [0:0.2:1]; [A, R] = meshgrid(a,r); Z = sqrt(1-R.^2); [X, Y] = pol2cart(A, R); mesh(X, Y, Z) colormap(cool) fill3(rand(3,4), rand(3,4), rand(3,4), rand(3,4))