# drawSpiral - %a circle has total radians 2.*pi; and it will...

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

function drawSpiral(rev,d,p) %drawSpiral will plot a spiral oriented along the z-axis as is %demonstrated in sampleSpiral.jpg. The inputs to your function will be %the number of revolutions of the spiral, the vertical distance between %the beginning and ending of each individual revolution, and the number %of points that each revolution will contain. The spiral should have a %radius of 2, start on the xy plane, revolve around the z axis, and %should ascend counterclockwise. You should title the plot "Spiral" and %label the axes "x-axis", "y-axis", and "z-axis". Also set the axis to %square. You may assume all inputs will be greater than zero. r = 2; %initializes the radius at 2 phi = linspace(0,2.*pi.*rev,p.*rev);
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %a circle has total radians 2.*pi; and it will have the number of points %multiplied by the number of revolutions x = r.*cos(phi); %the x-variable will be cos of the phi values y = r.*sin(phi); %the y-variable will be sin of the phi values z = linspace(0,d.*rev,p.*rev); %the z-variable will be the number of points multiplied by the number of %revolutions, between 0 and the distance multiplied by the number of %revolutions plot3(x,y,z); %plots the 3 variables title('Spiral'); %titles the graph xlabel('x-axis'); ylabel('y-axis'); zlabel('z-axis'); %above three label the x,y, and z axes respectively axis square; %makes the length of the axes the same 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