Académique Documents
Professionnel Documents
Culture Documents
3
SIMPLE SOLID MENSURATION MATLAB PROGRAM
1. Objective:
The activity aims to create matlab program that will ask the user to choose between the two types of figures
in solid mensuration and output the area, perimeter/circumference, volume or surface area of a certain
figure.
3. Discussion :
Solid Mensuration is a branch of mathematics that deals with the area and perimeter/circumference of
plane figures and volume and surface area of solid figures.
4. Resources:
Matlab
5. Procedure:
1. Using the matlab editor , choose File/New/ Blank m-file , type the following:
clc;
disp('Area of the Rectangle');
% Input here…
length=input('Enter the length of the rectangle: ');
width=input('Enter the width of the rectangle :');
% Process here…
area=length*width;
% Output here …
fprintf('The area of the rectangle is %0.2f. ',area );
2. Save the file as areaRectangle. Run the program and record the results.
3. Create m-file for the area of the square, right triangle, oblique triangle, circle and ellipse.
4. Create m-file for the perimeter of square, rectangle, right triangle, oblique triangle, circle and
ellipse. For circle, use circumference instead of perimeter.
5. Create m-file for the volume of cone, sphere, rectangular parallelepiped, right circular cylinder and
cube.
6. Create m-file for the surface area of cone, sphere, rectangular parallelepiped, right circular cylinder
and cube.
7. Using the matlab editor, choose File/New/Blank m-file, type the following:
clc;
disp('Area and Perimeter of the Rectangle');
choose=input('\n 1. Area of the Rectangle \n 2. Perimeter of the Rectangle \n Choose 1 or 2: ');
switch(choose)
case 1;
length=input('Enter the length of the rectangle: ');
width=input('Enter the width of the rectangle :');
area=length*width;
fprintf('The area of the rectangle is %0.2f. ',area );
break;
case 2;
length=input('Enter the length of the rectangle: ');
width=input('Enter the width of the rectangle :');
perimeter= 2*length + 2*width;
fprintf('The perimeter of the rectangle is %0.2f. ',perimeter );
break;
end
Save the file as areaPeriRect.m and run.
8. Create a matlab program that will ask the user to choose between plane figures and solid figures.
If the user will choose plane figures, he will then be ask to choose among the five (5) plane figures as
mentioned in Procedure No. 4. After choosing any of the five (5) plane figures, he will then be ask
to choose between area and perimeter. If the user will choose solid figures, he will then be ask to
choose among the five (5) solid figures as mentioned in Procedure No. 5. After choosing any of the
five (5) solid figures, he will then be ask to choose between volume and surface area. Necessary
inputs are needed and the output will be any of the area or perimeter of any of the five (5) plane
figures and any of the volume and surface area of any of the five (5) solid figures.
Course: CHE508 Laboratory Exercise No.: 3
Group No.: Section: CH51FA2
Group Members: Aquino, Airah D.S Date Performed: December 14, 2018
Date Submitted: January 04, 2019
Instructor: Engr. Crispulo Maranan
Procedure Results
2 Area of the Rectangle
Enter the length of the rectangle: 15
Enter the width of the rectangle :12
The area of the rectangle is 180.00. >>
case 2
disp('Volume of the Rectangular Parallelepiped');
l=input('Enter the length of the Rectangular Parallelepiped:');
w=input('Enter the width of the Rectangular Parallelepiped:');
h=input('Enter the height of the Rectangular Parallelepiped:');
a=l*w*h;
fprintf('The volume of the Rectangular Parallelepiped is %0.2f.',a);
e nd
case 4
choose=input('n\ 1. Surface Area \n 2. Volume \n Choose 1 or 2:');
switch(choose)
case 1
disp('Surface Area of the Cylinder');
r=input('Enter the radius of the cylinder: ');
h=input('Enter the height of the cylinder: ');
area=(2*pi*r*h)+(2*pi*r^2);
fprintf('The Surface Area of the cone is %0.2f. ', area);
case 2
disp('Volume of the Cylinder');
r=input('Enter the radius of the cylinder: ');
h=input('Enter the height of the cylinder: ');
area=(h*pi*r^2);
fprintf('The Volume of the Cyinder is %0.2f. ', area);
end
case 5
choose=input('n\ 1. Surface Area \n 2. Volume \n Choose 1 or 2:');
switch(choose)
case 1
disp('Surface Area of the Cube');
s=input ('Enter the Side of the Cube: ');
area=6*s^2;
fprintf('The Surface Area of the Cube is %0.2f. ', area);
case 2
disp('Volume of the Cube');
s=input ('Enter the Side of the Cube: ');
area=s^3;
fprintf('The Volume of the Cube is %0.2f. ', area)
end
e nd
case 2
choose=input('\n 1. Square \n 2. Rectangle \n 3. Right Triangle \n 4. Circle \n 5. Ellipse
e 1 to 5: ');
switch (choose)
case 1
choose=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(choose)
case 1
disp('Area of the Square');
s=input('Enter the side of the square: ');
a=s^2;
fprintf('The Area f the Square is %0.2f. ', a);
case 2
disp('Perimeter of the Square');
s=input('Enter the side of the square: ');
p=4*s;
fprintf('The Perimeter of the Square is %0.2f. ', p);
e nd
case 2
choose=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(choose)
case 1
disp('Area of the Rectangle');
l=input('Enter the Length of the Rectangle: ');
w=input('Enter the Width of the Rectangle: ');
a=l*w;
fprintf('The Area of the Rectangle is %0.2f. ', a);
case 2
disp('Perimeter of the Rectangle');
l=input('Enter the Length of the Rectangle: ');
w=input('Enter the Width of the Rectangle: ');
p=2*(l*w);
fprintf('The Perimeter of the Rectangle is %0.2f. ', p);
end
case 3
choose=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(choose)
case 1
disp('Area of the Right Triangle');
b=input('Enter the base of the right triangle: ');
h=input('Enter the height of the right triangle: ');
a=(b*h)/2;
fprint('The Area of the Right Triangle is %0.2f. ', a);
case 2
disp('Perimeter of the Right Triangle');
b=input('Enter the base of the right triangle: ');
h=input('Enter the height of the right triangle: ');
p=h+b+sqrt(h^2+b^2);
fprint('The Perimeter of the Right Triangle is %0.2f. ', a);
end
case 4
choose=input('\n 1. Area \n 2. Circumference \n Choose 1 or 2: ');
switch(choose)
case 1
disp=('Area of the Circle');
r=input('Enter the Radius of the Circle: ');
a=pi*r^2;
fprintf('The Area of the Circle is %0.2f. ', a);
case 2
disp=('Circumference of the Circle');
r=input('Enter the Radius of the Circle: ');
c=2*pi*r;
fprintf('The Circumference of the Circle is %0.2f. ', c);
e nd
case 5
choose=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(choose)
case 1
disp('Area of the Ellipse');
a=input('Enter the a axis of the ellipse: ');
b=input('Enter the b axis of the ellipse: ');
a=pi*a*b;
fprintf('The Area of the Ellipse is %0.2f. ', a);
case 2
disp('Perimeter of the Ellipse');
a=input('Enter the a axis of the ellipse: ');
b=input('Enter the b axis of the ellipse: ');
p=2*pi*sqrt((a^2+b^2)/2);
fprintf('The Area of the Ellipse is %0.2f. ', p);
end
end
end
Choose 1 or 2: 2
1. Square
2. Rectangle
3. Right Triangle
4. Circle
5. Ellipse
Choose 1 to 5: 5
1. Area
2. Perimeter
Choose 1 or 2: 1
Area of the Ellipse
Enter the minor radius of the ellipse: 5
Enter the major radius of the ellipse :12
The area of the ellipse is 188.50
Choose 1 to 5: 3
1. Surface Area
2. Volume
Choose 1 or 2:1
Surface Area of the Rectangular Parallelepiped
Enter the length of the Rectangular Parallelepiped:9.3
Enter the width of the Rectangular Parallelepiped:5.6
Enter the height of the Rectangular Parallelepiped:7.9
The surface area of the Rectangular Parallelepiped is 339.58
7. Conclusion:
I therefore conclude that the MATLAB m-file can be a useful tool in solving and creating matlab
program that will ask the user to choose between the two types of figures in solid mensuration and
output the area, perimeter/circumference, volume or surface area of a certain figure.
8. Assessment (Rubric for Laboratory Performance):
TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES
RUBRIC FOR MODERN TOOL USAGE
(Engineering Programs)
Student Outcome (e): Use the techniques, skills, and modern engineering tools necessary for engineering
practice in complex engineering activities.
Program: Chemical Engineering Course: CHE 508 Section: CH51FA2 2nd Sem SY 2018-2019
Performance Unsatisfactory Developing Satisfactory Very Satisfactory Score
Indicators 1 2 3 4
1. Apply Fails to identify Identifies Identifies modern Recognizes the
appropriate any modern modern techniques and is benefits and
techniques, techniques to techniques but able to apply constraints of
skills, and perform fails to apply these in modern
modern discipline-speci these in performing engineering tools
tools to fic engineering performing discipline-specific and shows
perform a task. discipline-spec engineering task. intention to apply
discipline-sp ific them for
ecific engineering engineering
engineering task. practice.
task.
2. Demonstrat Fails to apply Attempts to Shows ability to Shows ability to
e skills in any modern apply modern apply fundamental apply the most
applying tools to solve tools but has procedures in appropriate and
different engineering difficulties to using modern effective modern
techniques problems. solve tools when solving tools to solve
and modern engineering engineering engineering
tools to problems. problems. problems.
solve
engineering
problems.
3. Recognize Does not Recognizes Recognizes the Recognizes the
the benefits recognize the some benefits benefits and need for benefits
and benefits and and constraints of and constraints of
constraints constraints of constraints of modern modern
of modern modern modern engineering tools engineering tools
engineering engineering engineering and shows and makes good
tools. tools. tools. intention to apply use of them for
them for engineering
engineering practice.
practice.
Total Score
Mean Score = (Total Score / 3)
Percentage Rating = (Total Score / 12) x 100%
Evaluated by: ______________________________________ _______________
Printed Name and Signature of Faculty Member Date