% MATLAB Lecture 5 Wednesday 16 November 2005 % 1. Spheres and Cylinders [x,y,z] = sphere(10); size(x) ans = 11 11 mesh(x,y,z) [x,y,z] = sphere(100); mesh(x,y,z) % another sampling primitive is cylinder: [x,y,z] = cylinder(30); mesh(x,y,z) % cones can be made using the cylinder: [x,y,z] = cylinder([1 0]); mesh(x,y,z) % The argument of cylinder is the % radius of the cylinder. t = 0:0.01:1; % sampling range r = cos(t); % cosine as radius cylinder(r) % we made a cylinder whose walls % are defined by the cosine % With cylinder we can make any % so-called surface of revolution. % 2. Splines % Splines are used in computer aided design % In making a more complicated plot, edit % we better store the instructions in an m-file. cd h: help car shows the profile of a car car fschange('H:\car.m'); car % 3. Three dimensional modeling edit clear('H:\polyhedron.m'); polyhedron edit fschange('H:\polytope.m'); polytope f = 1 2 6 1 6 3 1 4 6 1 6 5 diary off