close all
X=-2:0.1:2; 
Y=-2:0.1:2;
[x,y]=meshgrid(X,Y);

z1=x.^2 + y.^2;
z2=-z1;

subplot(1,2,1)
surf(x,y,z1)
hold
surf(x,y,z2)

subplot(1,2,2)
term=x.^2+y.^2;
s=size(term);
s1=s(1);
s2=s(2);

for j=1:s1
    for k=1:s2
        if term(j,k)<=3
            z1(j,k)=NaN;
            z2(j,k)=NaN;
        end
    end
end

surf(x,y,z1)
hold
surf(x,y,z2)
