close all % Vi stänger alla figurfönster R=get(0,'ScreenSize'); pos=[R(1)+20,R(2)+40,R(3)-40,R(4)-120]; figure(1) set(1,'Position',pos) title('\bf Andragradsytor: ','FontSize',24) pause title('\bf Ellipsoider: x^2/a^2 + y^2/b^2 + z^2/c^2 = 1.','FontSize',24) pause(1) a=2;b=1;c=1; s=0:(pi/20):(pi+.01);t=0:(pi/20):(2*pi+.01); [S,T]=meshgrid(s,t); X=a.*sin(S).*cos(T); Y=b.*sin(S).*sin(T); Z=c.*cos(S); mesh(X,Y,Z);hold on,lighting phong,axis equal,axis off,shg title('\bf Ellipsoider: x^2/a^2 + y^2/b^2 + z^2/c^2 = 1.','FontSize',24) pause figure(2) set(2,'Position',pos) title('\bf Tvåmantlad Hyperboloid: x^2/a^2 + y^2/b^2 - z^2/c^2 = -1.','FontSize',24) pause(1) a=1;b=1;c=1.5; s=0:(pi/20):(2*pi+.01);t=-2:.1:2; [S,T]=meshgrid(s,t); X=a.*sinh(T).*cos(S); Y=b.*sinh(T).*sin(S); Z=c.*cosh(T); hold off;mesh(X,Y,Z);hold on,lighting phong,mesh(X,Y,-Z),axis equal,axis off, shg title('\bf Tvåmantlad Hyperboloid: x^2/a^2 + y^2/b^2 - z^2/c^2 = -1.','FontSize',24) pause figure(3) set(3,'Position',pos) title('\bf Enmantlad Hyperboloid: x^2/a^2 + y^2/b^2 - z^2/c^2 = 1.','FontSize',24) pause(1) a=1;b=1;c=1; s=0:(pi/20):(2*pi+.01);t=-2:.1:2; [S,T]=meshgrid(s,t); X=a.*cosh(T).*cos(S); Y=b.*cosh(T).*sin(S); Z=c.*sinh(T); hold off;mesh(X,Y,Z);hold on,lighting phong,axis equal,axis off, shg title('\bf Enmantlad Hyperboloid: x^2/a^2 + y^2/b^2 - z^2/c^2 = 1.','FontSize',24) pause figure(4) set(4,'Position',pos) title('\bf Elliptisk Paraboloid: z = x^2/a^2 + y^2/b^2.','FontSize',24) pause(1) a=2;b=1; s=0:(pi/20):(2*pi+.01);t=0:.05:2; [S,T]=meshgrid(s,t); X=a.*T.*cos(S); Y=b.*T.*sin(S); Z=T.^2; mesh(X,Y,Z);hold on,lighting phong,axis equal,axis off, shg title('\bf Elliptisk Paraboloid: z = x^2/a^2 + y^2/b^2.','FontSize',24) pause figure(5) set(5,'Position',pos) title('\bf Hyperbolisk Paraboloid: z = x^2/a^2 - y^2/b^2.','FontSize',24) pause(1) a=3;b=2; x=-10:.2:10;y=-4:.2:4; [X,Y]=meshgrid(x,y); Z=X.^2./a.^2 - Y.^2./b.^2; mesh(X,Y,Z);lighting phong,axis equal,axis off, shg title('\bf Hyperbolisk Paraboloid: z = x^2/a^2 - y^2/b^2.','FontSize',24) pause figure(6) set(6,'Position',pos) title('\bf Koner: x^2/a^2 + y^2/b^2 - z^2 = 0.','FontSize',24) pause(1) a=2;b=1;c=1; s=-2:.1:2;t=0:(pi/20):(2*pi+.01); [S,T]=meshgrid(s,t); X=a.*S.*cos(T); Y=b.*S.*sin(T); Z=S; mesh(X,Y,Z);hold on,lighting phong,axis equal,axis off, shg title('\bf Koner: x^2/a^2 + y^2/b^2 - z^2 = 0.','FontSize',24) pause figure(7) set(7,'Position',pos) title('\bf Elliptisk Cylinder: x^2/a^2 + y^2/b^2 = 1.','FontSize',24) pause(1) a=2;b=1;c=1; s=-2:.1:2;t=0:(pi/20):(2*pi+.01); [S,T]=meshgrid(s,t); X=a.*cos(T); Y=b.*sin(T); Z=S; mesh(X,Y,Z);hold on,lighting phong,axis equal,axis off, shg, title('\bf Elliptisk Cylinder: x^2/a^2 + y^2/b^2 = 1.','FontSize',24) pause figure(8) set(8,'Position',pos) title('\bf Hyperbolisk Cylinder: x^2/a^2 - y^2/b^2 = 1.','FontSize',24) pause(1) a=2;b=1;c=1; s=-2:.1:2;t=-2:.1:2; [S,T]=meshgrid(s,t); X=a.*cosh(T); Y=b.*sinh(T); Z=S; mesh(X,Y,Z);hold on,lighting phong,mesh(-X,Y,Z),axis equal,axis off, shg title('\bf Hyperbolisk Cylinder: x^2/a^2 - y^2/b^2 = 1.','FontSize',24) pause figure(9) set(9,'Position',pos) title('\bf Parabolisk Cylinder: x = y^2/b^2 eller y = x^2/a^2','FontSize',24) pause(1) a=2;b=1;c=1; s=-2:.1:2;y=-2:.1:2; [S,T]=meshgrid(s,y); X=Y.^2./b^2; Z=S; mesh(X,Y,Z);hold on,lighting phong,axis equal,axis off, shg title('\bf Parabolisk Cylinder: x = y^2/b^2 eller y = x^2/a^2','FontSize',24) pause figure(10) set(10,'Position',pos) title('\bf Andragradskurvor: ','FontSize',24) pause title('\bf Ellipser: x^2/a^2 + y^2/b^2 = 1.','FontSize',24) pause(1) a=2;b=1;c=1; t=0:(pi/20):(2*pi+.01); X=a*cos(t); Y=b*sin(t); plot(X,Y);hold on,axis equal,shg title('\bf Ellipser: x^2/a^2 + y^2/b^2 = 1.','FontSize',24) pause figure(11) set(11,'Position',pos) title('\bf Hyperbler: x^2/a^2 - y^2/b^2 = 1.','FontSize',24) pause(1) a=2;b=1;c=1; t=linspace(-3,3,200); X=a*cosh(t); Y=b*sinh(t); plot(X,Y);hold on,plot(-X,Y);axis equal,shg title('\bf Hyperbler: x^2/a^2 - y^2/b^2 = 1.','FontSize',24) pause