Vous êtes sur la page 1sur 12

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

6. Data and Results:

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. >>

3a Area of the Square


>> side=4;
>> area=side^2;
The area of the square is 16.00. >>

Area of the Right Triangle


>> base=36;
>> height=12;
>> area=(1/2)*(base)*(height);
The area of the Right Triangle is 216.00. >>

Area of the Oblique Triangle


>> b=10;
>> hb=12;
>> area=(1/2)*(b)*(hb);
The area of the Oblique Triangle is 60.00. >>

Area of the Circle


>> r=5;
>> area=(pi)*r^2;
The area of the Circle is 78.54. >>

Area of the Ellipse


>> a=13;
>> b=16;
>> area=pi*a*b;
The area of the Ellipse is 653.45 >>
4 Perimeter of the Square
>> side=12;
>> perimeter=4*side;
The perimeter of the Square is 48.00. >>
Perimeter of the Right Triangle
>> a=24;
>> b=12;
>> perimeter=a+b+sqrt(a^2+b^2);
The perimeter of the Right Triangle is 62.83. >>
Perimeter of the Oblique Triangle
>> a=15;
>> b=26;
>> c=36;
>> perimeter=a+b+c;
The perimeter of the Oblique Triangle is 77.00. >>
Circumference of the Circle
>> r=10;
>> Circumference=2*pi*r;
The circumference of the Circle is 62.83. >>
Circumference of the Ellipse
>> a=14.9
>> b=12.6
The circumference of the Ellipse is 86.70>>
5 Volume of the Cone
>>radius of the cone: 20
>>height of the cone: 15
The volume of the cone is 6283.19>>
Volume of the Sphere
>>radius of the sphere: 17.2
The volume of the sphere is 21314.44>>
Volume of the rectangular parallelepiped
>>length of the rectangular parallelepiped: 22.9
>>height of the rectangular parallelepiped: 15.8
The volume of the rectangular parallelepiped is 14684.66>>
Volume of the right circular cylinder
>>length of the right circular cylinder: 12.985
>>height of the right circular cylinder: 13.765
The volume of the right circular cylinder is 12793.31>>
Volume of the cube
>>edge of the cube: 16
The volume of the cube is 4096.00>>
6 Surface Area of the Cone
>>radius of the cone: 12
>>height of the cone:10
The surface area of the cone is 1041.27. >>
Surface Area of the sphere
>>radius of the sphere: 15
The surface area of the sphere is 14137.17. >>
Surface Area of the rectangular parallelepiped
>>height of the rectangular parallelepiped: 9.3
>> width of the rectangular parallelepiped: 5.6
>>length of the rectangular parallelepiped: 7.9
The surface area of the rectangular parallelepiped is 339.58. >>
Surface Area of the right circular cylinder
>>height of the right circular cylinder: 9
>>radius of the right circular cylinder: 6
The surface area of the right circular cylinder is 565.49. >>
Surface Area of the cube
>>edge of the cube: 12
The surface area of the cube is 864.00>>
7 clc;
disp(​'Solid or Plane Figure'​);
choose=input(​'\n 1. Solid Figure \n 2. Plane Figure \n Choose 1 or 2: '​);
switch​ (choose)
​case​ 1
choose=input(​'\n 1. Cone \n 2. Sphere \n 3. Rectangular Parellelepiped \n 4. Right Circ
r \n 5. Cube \n Choose 1 to 5: '​);
​switch​ (choose)
​case​ 1
choose=input(​'\n 1. Surface Area \n 2. Voume \n Choose 1 or 2: '​);
​switch​(choose)
​case​ 1
disp(​'Surface Area of the Cone'​);
r=input(​'Enter the radius of the cone: '​);
h=input(​'Enter the height of the cone: '​);
area=pi*r*(r+sqrt(h^2+r^2));
fprintf(​'The Surface Area of the cone is %0.2f. '​, area);
​case​ 2
disp(​'Volume of the Cone'​);
r=input(​'Enter the radius of the cone: '​);
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);
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

8  Solid or Plane Figure


1. Solid Figure
2. Plane Figure

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

Solid or Plane Figure


1. Solid Figure
2. Plane Figure
Choose 1 or 2: 1
1. Cone
2. Sphere
3. Rectangular Parallelepiped
4. Right Circular Cylinder
5. Cube

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

Vous aimerez peut-être aussi