You are on page 1of 14

TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES

363 P. Casal Street, Quiapo, Manila

CHEP 530D1
Computer Applications in Chemical Engineering

Engr. Crispulo G. Maranan


Instructor

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Laboratory Exercise No. 4


MATLAB July 20, 2015

Laboratory Exercise No. 4


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 switchcase break in creating MATLAB program for a simple solid mensuration problemsolving 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 a 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 square units.\n',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');

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Laboratory Exercise No. 4


MATLAB July 20, 2015

choose = input ('\n 1. Area of the Rectangle \n 2. Perimeter of the


Rectangle \n Choose 1 or 2: ');
switch (choose)
case 1;
clc
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.\n ',area );
break;
case 2;
clc
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.\n
',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.
6. Data and Results:
Procedu
re No.

MATLAB Result

2
3

Dangat, Jennifer G.
Simple Solid Mensuration
Program

AREA OF A SQUARE:

Laboratory Exercise No. 4


MATLAB July 20, 2015

AREA OF A RIGHT TRIANGLE:

AREA OF AN OBLIQUE TRIANGLE:

AREA OF A CIRCLE:

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Laboratory Exercise No. 4


MATLAB July 20, 2015

AREA OF AN ELLIPSE:

PERIMETER OF A SQUARE:

Dangat, Jennifer G.
Simple Solid Mensuration
Program

PERIMETER OF A RECTANGLE:

Laboratory Exercise No. 4


MATLAB July 20, 2015

PERIMETER OF A RIGHT TRIANGLE:

PERIMETER OF AN OBLIQUE TRIANGLE:

CIRCUMFERENCE OF A CIRCLE:

Dangat, Jennifer G.
Simple Solid Mensuration
Program

VOLUME OF A CONE:

Laboratory Exercise No. 4


MATLAB July 20, 2015

VOLUME OF A SPHERE:

VOLUME OF A RECTANGULAR PARALLELEPIPED:

VOLUME OF A RIGHT CIRCULAR CYLINDER:

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Laboratory Exercise No. 4


MATLAB July 20, 2015

VOLUME OF A CUBE:

SURFACE AREA OF A CUBE:

SURFACE AREA OF A SPHERE:

SURFACE AREA OF A RECTANGULAR PARALLELEPIPED:

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Laboratory Exercise No. 4


MATLAB July 20, 2015

SURFACE AREA OF A RIGHT CIRCULAR CYLINDER:

SURFACE AREA OF A CUBE:

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Laboratory Exercise No. 4


MATLAB July 20, 2015

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Laboratory Exercise No. 4


MATLAB July 20, 2015

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Laboratory Exercise No. 4


MATLAB July 20, 2015

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Laboratory Exercise No. 4


MATLAB July 20, 2015

7. Conclusion:
Based from the results of this exercise, it can be concluded that we can use the switch statement to
control which statements get executed based on conditions at the time the program is running. The
switch executes certain statements based on the value of a variable or expression. The switch works by
comparing the input expression to each case value.
8. Further Readings:
Gilat, A. (2008). MATLAB: An introduction with applications (3rd ed.). Hoboken, NJ: Wiley.
McMahon, D. (2007). MATLAB demystified. New York: McGraw-Hill.
9. 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 530D1 Section: CH51FC1 1st Sem SY 2015-2016
Performance
Indicators

Unsatisfactory
1

Dangat, Jennifer G.
Simple Solid Mensuration
Program

Developing
2

Satisfactory
3

Very Satisfactory
4

Laboratory Exercise No. 4


MATLAB July 20, 2015

Score

1.

Apply
appropriate
techniques,
skills,
and
modern tools
to perform a
disciplinespecific
engineering
task.

Fails to identify
any
modern
techniques
to
perform disciplinespecific
engineering task.

Identifies modern
techniques but
fails to apply
these
in
performing
discipline-specific
engineering task.

Identifies
modern
techniques and is able
to apply these in
performing disciplinespecific engineering
task.

Recognizes
the
benefits
and
constraints of modern
engineering tools and
shows intention to
apply
them
for
engineering practice.

2.

Demonstrate
skills
in
applying
different
techniques and
modern tools
to
solve
engineering
problems.
Recognize the
benefits and
constraints of
modern
engineering
tools.

Fails to apply any


modern tools to
solve engineering
problems.

Attempts to apply
modern tools but
has difficulties to
solve engineering
problems.

Shows ability to apply


fundamental
procedures in using
modern tools when
solving engineering
problems.

Shows ability to apply


the most appropriate
and effective modern
tools
to
solve
engineering problems.

Does
not
recognize
the
benefits
and
constraints
of
modern
engineering tools.

Recognizes some
benefits
and
constraints
of
modern
engineering tools.

Recognizes
the
benefits
and
constraints of modern
engineering tools and
shows intention to
apply
them
for
engineering practice.

Recognizes the need


for
benefits
and
constraints of modern
engineering tools and
makes good use of
them for engineering
practice.

3.

Total Score
Mean Score = (Total Score / 3)
Percentage Rating = (Total Score / 12) x 100%

Evaluated by:

______________________________________
Printed Name and Signature of Faculty Member

Dangat, Jennifer G.
Simple Solid Mensuration
Program

_______________
Date

Laboratory Exercise No. 4


MATLAB July 20, 2015

You might also like