{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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); u = [0 height 1 1 0]; v = [0 height height (height+height2) (height+height2)]; [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'); title('Top'); end...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online