You are on page 1of 17

Group No.

Group Members

1. Dela Cruz, Marenella 10/15/20

2. Dela Vega, Ela Jane P.


10/15/20
3. Dizon, Dietrich
10/15/20
4. Jongay, Mary Jane
10/15/20
5. Leonardo, Cynric D. 10/15/20

Date of Activity October 13, 2020


Date of Submission October 15, 2020

Engr. Crispulo G. Maranan

Leonardo, Cynric D.

Grading Criteria

Max Point Score Obtained


1 10

2 10

3 10

4 10

5 10

6 10

7 10

8 10

9 10

10 10

11 10

12 10

13 10

Total 130

Grade (TSO/TMP x 100)

Laboratory Exercise No. 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.
2. Intended Learning Outcomes (ILOs):
The students shall be able to:
2.1 create matlab programs that will determine the area and perimeter of five(5) plane figures
2.2 create matlab programs that will determine the volume and surface area of five(5) solid figures
2.3 use switch…case… break in creating matlab program for a simple solid mensuration problem-
solving situation.

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');
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 );

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
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: CHE 205 Laboratory Exercise No.: 3


Group No.: 2 Section: CHE22S1
Group Members: Date Performed: October 13, 2020
Dela Cruz Jongay Date Submitted: October 15, 2020
Dela Vega Dizon Instructor: Engr. Crispulo G. Maranan
6. Data and Results:
Procedur (Mfile) Editor Matlab Result (Command Window)
e
1-2 disp('Area of the Rectangle'); Area of the Rectangle
length=input('Enter the length of the Rectangle:'); Enter the length of the Rectangle:8
width=input('Enter the width of the Rectangle:'); Enter the width of the Rectangle:7
area=length*width; The area of the Rectangle is
fprintf('The area of the Rectangle is %0.2f.',area); 56.00.>>

3 clc; Area of the Square


disp('Area of the Square'); Enter the length of the Square:9
Side=input('Enter the length of the Square:'); The area of the Square is 81.00.>>
area=Side*Side;
fprintf('The area of the Square is %0.2f.',area);

clc; Area of the Right Triangle


disp('Area of the Right Triangle'); Enter the base of the Right
base=input('Enter the base of the Right Triangle:'); Triangle:22
height=input('Enter the height of the Right Enter the height of the Right
Triangle:'); Triangle:33
area=1/2*base*height; The area of the Right Triangle is
fprintf('The area of the Right Triangle is 363.00.>>
%0.2f.',area);

disp('Area of the Oblique Triangle'); Area of the Oblique Triangle


a=input('Enter the side1 of the Oblique Triangle: '); Enter the side1 of the Oblique
b=input('Enter the side2 of the Oblique Triangle:'); Triangle: 5
c=input('Enter the angle of triangle:') Enter the side2 of the Oblique
area=1/2*a*b*sin(c); Triangle: 6
fprintf('The area of the Oblique Triangle is %0.2f. Enter the angle of Triangle: 45
',area );
c=

45

The area of the Oblique Triangle is


12.76. >>
clc; Area of the Circle
disp('Area of the Circle'); Enter the radius of the Circle: 6
radius=input('Enter the radius of the Circle: '); The Area of the Circle is 113.10.
area=3.1416*radius^2;
fprintf('The Area of the Circle is %0.2f. ',area );
clc; Area of the Ellipse
disp('Area of the Ellipse'); Enter the distance from center to
a=input('Enter the distance from center to vertex of vertex of the ellipse: 43
the ellipse: '); Enter the distance from center to
b=input('Enter the distance from center to co-vertex co-vertex of the ellipse: 65
of the ellipse: '); The area of the Ellipse is 8780.77.
area=3.1416*a*b; >>
fprintf('The area of the Ellipse is %0.2f. ',area );

4 clc; Perimeter of the Square


disp('Perimeter of the Square'); Enter the length of the Square: 12
length=input('Enter the length of the Square: '); The Perimeter of the Square is
perimeter=length*4; 48.00. >>
fprintf('The Perimeter of the Square is %0.2f.
',perimeter);

clc; Perimeter of the Rectangle


disp('Perimeter of the Rectangle'); Enter the length of the Rectangle:
length=input('Enter the length of the Rectangle: '); 33
width=input('Enter the width of the Rectangle :'); Enter the width of the Rectangle :12
perimeter=2*(length+width); The Perimeter of the Rectangle is
fprintf('The Perimeter of the Rectangle is %0.2f. 90.00. >>
',perimeter );

clc; Perimeter of the Right triangle


disp('Perimeter of the Right triangle'); Enter the side of the Right Triangle:
a=input('Enter the side of the Right Triangle: '); 5
b=input('Enter the side of the Right Triangle :'); Enter the side of the Right Triangle :
perimeter=a+b+(sqrt(a^2+b^2)); 7
fprintf('The perimeter of the Right Triangle is %0.2f. The perimeter of the Right Triangle
',perimeter ); is 20.60. >>

clc; Perimeter of the Oblique Triangle


Enter the side1 of the Oblique
disp('Perimeter of the Oblique Triangle'); Triangle: 9
Enter the side2 of the Oblique
a=input('Enter the side1 of the Oblique Triangle: '); Triangle :8
Enter the side3 of Oblique Triangle7
b=input('Enter the side2 of the Oblique Triangle :');
c=
c=input('Enter the side3 of Oblique Triangle')

perimeter=a+b+c; 7

fprintf('The Perimeter of the Oblique Triangle is The Perimeter of the Oblique


%0.2f. ',perimeter ); Triangle is 24.00. >>

clc; Circumference of the circle

disp('Circumference of the circle');


Enter the radius of the circle: 78
radius=input('Enter the radius of the circle: ');

Circumference=2*3.1416*radius;
The Circumference of the circle is
fprintf('The Circumference of the Circle is %0.2f. 490.09. >>
',circumference);
clc; Perimeter of the ellipse
disp('Perimeter of the ellipse'); Enter the distance from center to
a=input('Enter the distance from center to vertex of vertex of the Ellipse: 15
the Ellipse: '); Enter the distance from center to
b=input('Enter the distance from center to co-vertex co-vertex of the Ellipse: 12
of the Ellipse: '); The Perimeter of the Ellipse is
perimeter =(2*3.1416) *(sqrt((a^2+b^2)/2)); 85.35. >>
fprintf('The Perimeter of the Ellipse is %0.2f.
',perimeter );

5 clc; Volume of Cone


disp('Volume of Cone'); Enter the radius of the base: 55
r=input('Enter the radius of the base: '); Enter the height of the cone: 77
h=input('Enter the height of the cone: '); The Volume of Cone is 243919.06.
volume=3.1416*r^2*(h/3); >>
fprintf('The Volume of Cone is %0.2f. ',volume);

clc; Volume of Sphere


disp('Volume of Sphere'); Enter the Radius of the Sphere: 99
r=input('Enter the Radius of the Sphere: '); The Volume of Sphere is
volume=(4/3)*3.1416*r^3; 4064388.45. >>
fprintf('The Volume of Sphere is %0.2f. ',volume);

clc; Rectangular Parallelepiped


disp('Rectangular Parallelepiped'); Enter the length of the Rectangular
l=input('Enter the length of the Rectangular Parallelepiped: 33
Parallelepiped : '); Enter the width of the Rectangular
w=input('Enter the width of the Rectangular Parallelepiped: 44
Parallelepiped: '); Enter the height of the Rectangular
h=input('Enter the height of the Rectangular Parallelepiped: 55
Parallelepiped: '); The Rectangular Parallelepiped is
volume=l*w*h; 79860.00. >>
fprintf('The Rectangular Parallelepiped is %0.2f.
',volume);

clc; Volume of Right Circular Cylinder


disp('Volume of Right Circular Cylinder'); Enter the radius of the Right Circular
r=input('Enter the radius of the Right Circular Cylinder: 77
Cylinder: '); Enter the height of the Right Circular
h=input('Enter the height of the Right Circular Cylinder: 43
Cylinder: '); The volume of Right Circular
volume=3.1416*r^2*h; Cylinder is 800941.50. >>
fprintf('The volume of Right Circular Cylinder is
%0.2f. ',volume);

clc; Volume of Cube


disp('Volume of Cube'); Enter the length of the side of the
s=input('Enter the length of the side of the Cube : '); Cube: 77
volume=s*3; The Volume of Cube is 231.00. >>
fprintf('The Volume of Cube is %0.2f. ',volume);

6 clc; Surface Area of Cone


disp('Surface Area of Cone'); Enter the radius of the base: 10
r=input('Enter the radius of the base: '); Enter the height of the Cone: 20
h=input('Enter the height of the Cone: '); The Surface Area of Cone is
surface area=3.1416*r*(r+(sqrt(h^2+r^2))); 1016.64. >>
fprintf('The Surface Area of Cone is %0.2f. ',surface
area);

clc; Surface area of sphere


disp('Surface area of sphere'); Enter the radius of the sphere: 88
r=input('Enter the radius of the sphere: '); The surface area of sphere is
surface area=3.1416*r^2*4; 97314.20. >>
fprintf('The surface area of sphere is %0.2f. ',surface
area);

clc; Surface Area Rectangular


disp('Surface Area Rectangular Parallelepiped'); Parallelepiped
l=input('Enter the length of the Rectangular Enter the length of the Rectangular
Parallelepiped : '); Parallelepiped: 15
w=input('Enter the width of the Rectangular Enter the width of the Rectangular
Parallelepiped: '); Parallelepiped: 10
h=input('Enter the height of the Rectangular Enter the height of the Rectangular
Parallelepiped: '); Parallelepiped: 15
surface area=2*((l*w)+(h*l)+(h*w)); The surface area of Rectangular
fprintf('The surface area of Rectangular Parallelepiped is 231.00. >>
Parallelepiped is %0.2f. ',volume);

clc; Surface area of Right Circular


disp('Surface area of Right Circular Cylinder'); Cylinder
r=input('Enter the radius of the base: '); Enter the radius of the base: 55
h=input('Enter the height of the cylinder: '); Enter the height of the cylinder: 34
surface area=(2* 3.1416*r*h)+(2*3.1416*r^2); The surface area of Right Circular
fprintf('The surface area of Right Circular Cylinder is Cylinder is 30756.26. >>
%0.2f. ',surface area);

clc; Surface area of Cube


disp('Surface area of Cube'); Enter the side of the Cube: 22
a=input('Enter the side of the Cube: '); The Surface area of Cube is
surface area=6*a^2; 2904.00. >>
fprintf('The Surface area of Cube is %0.2f. ',surface
area);

7 clc; Area and Perimeter of the Rectangle


disp('Area and Perimeter of the Rectangle');
choose=input('\n 1. Area of the Rectangle \n 2. 1. Area of the Rectangle
Perimeter of the Rectangle \n Choose 1 or 2: '); 2. Perimeter of the Rectangle
switch(choose)
case 1; Choose 1 or 2: 1
length=input('Enter the length of the rectangle: ');
width=input('Enter the width of the rectangle :'); Enter the length of the rectangle: 50
area=length*width;
fprintf('The area of the rectangle is %0.2f. ',area ); Enter the width of the rectangle :20

case 2; The area of the rectangle is


length=input('Enter the length of the rectangle: '); 1000.00. >>
width=input('Enter the width of the rectangle :');
perimeter= 2*length + 2*width;
fprintf('The perimeter of the rectangle is %0.2f.
',perimeter );

end

8. clc; Solid or Plane Figure


disp('Solid or Plane Figure');
choose=input('\n 1. Solid Figure \n 2. Plane Figure \n 1. Solid Figure
Choose 1 or 2: '); 2. Plane Figure
switch (choose)
case 1 Choose 1 or 2: 1
choose=input('\n 1. Cone \n 2. Sphere \n 3.
Rectangular Parallelepiped \n 4. Right Circular 1. Cone
Cylinder \n 5. Cube \n Choose 1 to 5: '); 2. Sphere
switch (choose) 3. Rectangular Parallelepiped
4. Right Circular Cylinder
case 1 5. Cube
choose=input('\n 1. Surface Area \n 2.
Volume \n Choose 1 or 2: '); Choose 1 to 5: 5
switch(choose)
case 1 1. Surface Area
disp('Surface Area of the Cone'); 2. Volume
r=input('Enter the radius of the cone:
'); Choose 1 or 2:2
h=input('Enter the height of the cone:
');
area=pi*r*(r+sqrt(h^2+r^2)); Volume of the Cube
fprintf('The Surface Area of the cone
is %0.2f. ', area); Enter the Side of the Cube: 100
case 2
disp('Volume of the Cone');
r=input('Enter the radius of the cone: The Volume of the Cube is
'); 1000000.00. >>
h=input('Enter the height of the cone:
');
vol=pi*r^2*(h/3);
fprintf('The Volume of the cone is
%0.2f. ', vol);
end

case 2
choose=input('\n 1. Surface Area \n 2.
Voume \n Choose 1 or 2: ');
switch(choose)
case 1
disp('Surface Area of the Sphere');
r=input ('Enter the Radius of the
Sphere: ');
area=4*pi*r^2;
fprintf('The Surface Area of the
Sphere is %0.2f. ', area);
case 2
disp('Volume of the Sphere');
r=input ('Enter the Radius of the
Sphere: ');
vol=(4/3)*pi*r^3;
fprintf('The Volume of the Sphere is
%0.2f. ', vol);
end
case 3
choose=input('n\ 1. Surface Area \n 2.
Volume \n Choose 1 or 2:');
switch(choose)
case 1
disp('Surface Area 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=2*((w*l)+(h*l)+(h*w));
fprintf('The surface area of the
Rectangular Parallelepiped is %0.2f.',a);

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);
end

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
end
case 2
choose=input('\n 1. Square \n 2. Rectangle \n
3. Right Triangle \n 4. Circle \n 5. Ellipse \n Choose
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);
end

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);
end

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

7. Conclusion:
I therefore conclude that in using MATLAB, I was able to create a program that will users an
instant answer in figuring the size, area, volume or perimeter of a certain solid. Geometry is a key attribute
of solids and of the bodies they comprise. It features in the solid visualizations provided by Solid blocks as
visual aides during modeling. It features also in the multibody visualizations displayed in Mechanics
Explorer following model assembly and during simulation. This is one purpose of solid geometry: to enable
visualization for an entire modeling workflow, from the conception of a single solid to the simulation of a
complete multibody model.
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 205 Section: CHE 22S1 1 st Sem SY:2020-2021
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- these in performing engineering tools
tools to specific performing discipline-specific and shows
perform a engineering discipline- engineering task. intention to apply
discipline- task. specific them for
specific engineering engineering
engineering task. practice.
task.
2. Demonstrate Fails to apply Attempts to Shows ability to Shows ability to
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: Engr. Crispulo G. Maranan October 15, 2020
Printed Name and Signature of Faculty Member Date

End of Laboratory Exercise 3

You might also like