makeTop - %interpolated shading. Also, label each...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function makeTop(height,height2) %Write a function named makeTop that will take in 2 heights and draw a %3D figure of a spinning top. The top should be rotated around the %z-axis. The dimensions of the top are as follows (in1 corresponds to %input 1, in2 to input 2): % - in1 is the height of the body of the top % - in2 is the height of the stem of the top % - Therefore, the total height of the top is in1 + in2 % - The body of the top will have a radius of in1 at its % largest point % - The radius of the stem should always be 1 %When plotting the figure, you should use the surf function with
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %interpolated shading. Also, label each respective axis like this: %'x-axis'. Finally, title your plot 'Top'. When defining your angles for %rotation, use 100 values. %usage: makeTop(height,height2); th = linspace(0,2.*pi,100); base = 0.5.*height; u = [0 0 height 0]; v = [0 height base 0]; [uu tth] = meshgrid(u,th); [vv tth] = meshgrid(v,th); rr = uu; xx = sin(tth).*rr; yy = cos(tth).*rr; zz = vv; surf(xx,yy,zz); shading interp; xlabel('x-axis'); ylabel('y-axis'); zlabel('z-axis'); z end...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online