volumes.m

# volumes.m - 30;1 30%This makes a input dialogue box to type...

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

%this is a program for finding the volume of an object volumemenu = menu ('What is the volume?','Sphere','Cube','Given Volume'); %This creates a menu of what shape the volume is of or if it is given. switch volumemenu case 1 sphere = inputdlg ({'Radius?'},'Sphere Volume', [1 30]); %This creates a text box to type the radius of the sphere r = str2num (sphere{1}); %converts the radius from script to a number v = ((4/3)*(pi*((r)^3))); %This is the equation of a sphere case 2 cube = inputdlg ({'Lengh?','Width?','Height?'},'Cube Dimensions',[1 30;1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 30;1 30]);%This makes a input dialogue box to type the dimensions of the box. l = str2num (cube{1}); %These change the dimensions from script to a number w = str2num (cube{2}); h = str2num (cube{3}); v = ((l)*(w)*(h)); %The equation for the volume of a box case 3 given = inputdlg ({'What is the volume?'},'Given Volume', [1 30]); %This allows the person to type in a given volume. v = str2num (given{1}); %this converts the text into a number end...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern