hw1q1 - to be used as inside diameter: '); ID = (P/100)*OD;...

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

View Full Document Right Arrow Icon
%HW1 Question 1: Matlab Code for developing an algorithm to determine the inner  diameter, material volume and surface area of a hollow cylinder when asking for outside  diameter, height, and what percentage of the outside diameter will be used as the inside  diameter.   EoSI = input('Enter the units: ', 's'); OD = input( 'Enter the cylinder outside diameter in  centimeters: ');  EoSI = input('Enter the units: ', 's'); H = input('Enter the cylinder height: ');  EoSI = input('Enter the units: ', 's'); P = input('Enter the percentage of outside diameter 
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: to be used as inside diameter: '); ID = (P/100)*OD; AreaTopBottom = (pi*(0.5*OD)^2)-(pi*(0.5*ID)^2); CircumferenceOuter = 2*pi*(0.5*OD); CircumferenceInner = 2*pi*(0.5*ID); Volume = AreaTopBottom*H; SurfaceArea = (CircumferenceOuter*H)+(CircumferenceInner*H)+(2*(AreaTopBottom)) ; fprintf (' Inside Diameter = %0.2f %s\n', ID, EoSI) fprintf(' Volume = %0.1f %s^3\n', Volume, EoSI) fprintf( ' Surface Area = %0.1f %s^2 \n', SurfaceArea, EoSI)...
View Full Document

This note was uploaded on 09/19/2011 for the course ENGE 1114 taught by Professor Twknott during the Fall '06 term at Virginia Tech.

Ask a homework question - tutors are online