clf
subplot(3,3,1)
f=@(x,y,z) x.^2+2*y.^2+3*z.^2;
x=linspace(-2,2,31);
y=linspace(-2,2,30);
z=linspace(-2,2,30);
[X,Y,Z] = meshgrid(x,y,z);
%clf
isosurface(X,Y,Z,f(X,Y,Z),1)
axis equal, alpha(0.3), grid, hold on
title('{\bf Ellipsoid}','FontSize',20 ,'Interpreter','latex')
u=linspace(0,pi,20);v=linspace(0,2*pi,21);
[U,V]=meshgrid(u,v);
X=sin(U).*cos(V);
Y=sin(U).*sin(V)/sqrt(2);
Z=cos(U)/sqrt(3);
contour3(X,Y,Z),
rotate3d on,hold off
view([1,1,1])

subplot(3,3,2)
f=@(x,y,z) x.^2/9-y.^2/4+z.^2;
x=linspace(-4,4,31);
y=linspace(-3,3,30);
z=linspace(-2,2,30);
[X,Y,Z] = meshgrid(x,y,z);
%clf
isosurface(X,Y,Z,f(X,Y,Z),1)
axis equal, alpha(0.3), grid, hold on
title('{\bf Enmantlad hyperboloid}','FontSize',20 ,'Interpreter','latex')
u=linspace(0,pi,20);v=linspace(0,2*pi,21);
[X,Y]=meshgrid(x,y);
Z=sqrt(1-X.^2/9+Y.^2/4).*(1-X.^2/9+Y.^2/4>0);
contour3(X,Y,Z)
Z=-sqrt(1-X.^2/9+Y.^2/4).*(1-X.^2/9+Y.^2/4>0);
contour3(X,Y,Z),
rotate3d on,hold off
view([1,1,1])

subplot(3,3,3)
f=@(x,y,z) x.^2/9-y.^2/4+z.^2;
x=linspace(-4,4,31);
y=linspace(-3,3,30);
z=linspace(-2,2,30);
[X,Y,Z] = meshgrid(x,y,z);
%clf
isosurface(X,Y,Z,f(X,Y,Z),-0.2)
axis equal, alpha(0.3), grid, hold on
title('{\bf Tv\aa mantlad hyperboloid}','FontSize',20 ,'Interpreter','latex')
u=linspace(0,pi,20);v=linspace(0,2*pi,21);
[X,Y]=meshgrid(x,y);
Z=sqrt(-0.2-X.^2/9+Y.^2/4).*(-0.2-X.^2/9+Y.^2/4>0);
contour3(X,Y,Z)
%pause
Z=-sqrt(-0.2-X.^2/9+Y.^2/4).*(-0.2-X.^2/9+Y.^2/4>0);
contour3(X,Y,Z)
rotate3d on,hold off
view([1,1,1])

subplot(3,3,4)
f=@(x,y,z) x.^2/4+z.^2-y;
x=linspace(-6,6,31);
y=linspace(-4,4,30);
z=linspace(-4,4,30);
[X,Y,Z] = meshgrid(x,y,z);
%clf
isosurface(X,Y,Z,f(X,Y,Z),0)
axis equal, alpha(0.3), grid, hold on
title('{\bf Elliptisk paraboloid}','FontSize',20 ,'Interpreter','latex')
u=linspace(0,pi,20);v=linspace(0,2*pi,21);
x=2*sqrt(2).*cos(v);
y=2*ones(size(x));
z=sqrt(2).*sin(v);
plot3(x,y,z,'cyan')
x=2*sqrt(4).*cos(v);
y=4*ones(size(x));
z=sqrt(4).*sin(v);
plot3(x,y,z,'r')
x=2*sqrt(1).*cos(v);
y=1*ones(size(x));
z=sqrt(1).*sin(v);
plot3(x,y,z,'y')
x=2*sqrt(3).*cos(v);
y=3*ones(size(x));
z=sqrt(3).*sin(v);
plot3(x,y,z,'b')
rotate3d on,hold off
view([1,1,1])

subplot(3,3,5)
f=@(x,y,z) x.^2/9-y.^2/4-z;
x=linspace(-6,6,31);
y=linspace(-4,4,30);
z=linspace(-4,4,30);
[X,Y,Z] = meshgrid(x,y,z);
%clf
isosurface(X,Y,Z,f(X,Y,Z),0)
axis equal, alpha(0.3), grid, hold on
title('{\bf Hyperbolisk paraboloid}','FontSize',20 ,'Interpreter','latex')
[X,Y]=meshgrid(x,y);
Z=X.^2/9-Y.^2/4;
contour3(X,Y,Z)
rotate3d on,hold off
view([1,1,1])

subplot(3,3,6)
f=@(x,y,z) x.^2/9+y.^2/4-z.^2;
x=linspace(-3,3,31);
y=linspace(-2,2,30);
z=linspace(-1,1,30);
[X,Y,Z] = meshgrid(x,y,z);
%clf
isosurface(X,Y,Z,f(X,Y,Z),0)
axis equal, alpha(0.3), grid, hold on
title('{\bf Elliptisk kon}','FontSize',20 ,'Interpreter','latex')
u=linspace(0,pi,20);v=linspace(0,2*pi,21);
[U,V]=meshgrid(u,v);
X=3*sin(U).*cos(V);
Y=2*sin(U).*sin(V);
Z=sqrt(X.^2/9+Y.^2/4);
contour3(X,Y,Z),
Z=-sqrt(X.^2/9+Y.^2/4);
contour3(X,Y,Z),
rotate3d on,hold off
view([1,1,1])

subplot(3,3,7)
f=@(x,y,z) x.^2/9+y.^2/4;
x=linspace(-6,6,31);
y=linspace(-4,4,30);
z=linspace(-4,4,30);
[X,Y,Z] = meshgrid(x,y,z);
%clf
isosurface(X,Y,Z,f(X,Y,Z),1)
axis equal, alpha(0.3), grid, hold on
title('{\bf Elliptisk cylinder}','FontSize',20 ,'Interpreter','latex')
u=linspace(0,pi,20);v=linspace(0,2*pi,20);
x=3*cos(v);
y=2*sin(v);
z=ones(size(x));
plot3(x,y,z)
z=-ones(size(x));
plot3(x,y,z)
z=0*ones(size(x));
plot3(x,y,z)
z=2*ones(size(x));
plot3(x,y,z)
z=-3*ones(size(x));
plot3(x,y,z)
z=-2*ones(size(x));
plot3(x,y,z)
z=3*ones(size(x));
plot3(x,y,z)
rotate3d on,hold off
view([1,1,1])

subplot(3,3,8)
f=@(x,y,z) x.^2/4-y;
x=linspace(-6,6,31);
y=linspace(0,8,30);
z=linspace(-4,4,30);
[X,Y,Z] = meshgrid(x,y,z);
%clf
isosurface(X,Y,Z,f(X,Y,Z),0)
axis equal, alpha(0.3), grid, hold on
title('{\bf Parabolisk cylinder}','FontSize',20 ,'Interpreter','latex')
y=x.^2/4;
z=ones(size(x));
plot3(x,y,z)
z=-ones(size(x));
plot3(x,y,z)
z=0*ones(size(x));
plot3(x,y,z)
z=2*ones(size(x));
plot3(x,y,z)
z=-3*ones(size(x));
plot3(x,y,z)
z=-2*ones(size(x));
plot3(x,y,z)
z=3*ones(size(x));
plot3(x,y,z)
rotate3d on,hold off
view([1,1,1])

subplot(3,3,9)
f=@(x,y,z) x.^2/9-y.^2/4;
x=linspace(-6,6,31);
y=linspace(-4,4,30);
z=linspace(-4,4,30);
[X,Y,Z] = meshgrid(x,y,z);
%clf
isosurface(X,Y,Z,f(X,Y,Z),1)
axis equal, alpha(0.3), grid, hold on
title('{\bf Hyperbolisk cylinder}','FontSize',20 ,'Interpreter','latex')
y=linspace(-4,4,31);
x=3*sqrt(1+y.^2/4);
z=ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=-3*sqrt(1+y.^2/4);
z=ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=3*sqrt(1+y.^2/4);
z=2*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=-3*sqrt(1+y.^2/4);
z=2*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=3*sqrt(1+y.^2/4);
z=0*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=-3*sqrt(1+y.^2/4);
z=0*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=3*sqrt(1+y.^2/4);
z=3*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=-3*sqrt(1+y.^2/4);
z=3*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=3*sqrt(1+y.^2/4);
z=-2*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=-3*sqrt(1+y.^2/4);
z=-2*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=3*sqrt(1+y.^2/4);
z=-3*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=-3*sqrt(1+y.^2/4);
z=-3*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=3*sqrt(1+y.^2/4);
z=-1*ones(size(x));
plot3(x,y,z)
y=linspace(-4,4,31);
x=-3*sqrt(1+y.^2/4);
z=-1*ones(size(x));
plot3(x,y,z)
rotate3d on,hold off
view([1,1,1])