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.
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 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:
Group No.:
Group Members:
Date Submitted: Instructor:
Results
2
clc;
disp('Area of the Square');
%Input here...
length=input('Enter the length of the Square:');
width=input('Enter the width of the Square:');
%Process here...
area=length*width;
%Output here...
fprintf('The area of the square is %0.2f.',area );
clc;
disp('Area of the Right Triangle');
%Input here...
base=input('Enter the base of the Right
Triangle:');
height=input('Enter the height of the Right
Triangle:');
%Process here...
area=(1/2)*base*height;
%Output here...
fprintf('The area of the square is %0.2f.',area );
clc;
disp('Area of the Oblique Triangle');
%Input here...
a=input('Enter the side a of the Oblique
Triangle:');
b=input('Enter the side b of the Oblique
Triangle:');
c=input('Enter the side c of the Oblique
Triangle:');
%Process here...
s = (a+b+c)/2
area=sqrt(s*(s-a)*(s-b)*(s-c));
%Output here...
fprintf('The area of the square is %0.2f.',area );
clc;
disp('Area of the Circle');
%Input here...
radius=input('Enter the radius of the Circle:');
%Process here...
area=pi*radius^2;
%Output here...
fprintf('The area of the Circle is %0.2f.',area );
clc;
disp('Area of the Ellipse');
%Input here...
a=input('Enter the major of the Ellipse:');
b=input('Enter the minor of the Ellipse:');
%Process here...
area=pi*a*b;
%Output here...
fprintf('The area of the Ellipse is %0.2f.',area );
clc;
disp('Perimeter of the Square');
%Input here...
s=input('Enter the side of the Square:');
%Process here...
perimeter=4*s;
%Output here...
fprintf('The perimeter of the Square is
%0.2f.',perimeter );
clc;
disp('Perimeter of the Right Triangle');
%Input here...
a=input('Enter the side a of the Right Triangle:');
b=input('Enter the side b of the Right Triangle:');
%Process here...
perimeter= a + b + (sqrt(a^2 + b^2));
%Output here...
fprintf('The perimeter of the Right Triangle is
%0.2f.',perimeter );
clc;
disp('Perimeter of the Oblique Triangle');
%Input here...
a=input('Enter the side a of the Oblique
Triangle:');
b=input('Enter the side b of the Oblique
Triangle:');
c=input('Enter the side c of the Oblique
Triangle:');
%Process here...
perimeter= a + b + c;
%Output here...
fprintf('The perimeter of the Oblique Triangle is
%0.2f.',perimeter );
clc;
disp('Circumference of the Circle');
%Input here...
r=input('Enter the radius of the Circle:');
%Process here...
circumference= 2*pi*r;
%Output here...
fprintf('The circumference of the Circle is
%0.2f.',circumference );
clc;
disp('Perimeter of the Ellipse');
%Input here...
a=input('Enter the major of the Ellipse:');
b=input('Enter the minor of the Ellipse:');
%Process here...
perimeter= 2*pi*(sqrt((a^2 + b^2)/2));
%Output here...
fprintf('The perimeter of the Ellipse is
%0.2f.',perimeter );
5
clc;
disp('Volume of the Cone');
%Input here...
r=input('Enter the radius of the Ellipse:');
h=input('Enter the height of the Ellipse:');
%Process here...
volume= (1/3)*pi*r^2*h;
%Output here...
clc;
disp('Volume of the Sphere');
%Input here...
r=input('Enter the radius of the Sphere:');
%Process here...
volume=(4/3)*pi*r^3 ;
%Output here...
fprintf('The volume of the Sphere is
%0.2f.',volume );
clc;
disp('Volume of the Cube');
%Input here...
s=input('Enter the sides of the cube:');
%Process here...
volume=s^3 ;
%Output here...
fprintf('The volume of the Cube is
%0.2f.',volume );
6
Surface Area of Cone
Enter the radius of the Cone: 56
clc;
Enter the height of Cone: 78
disp('Surface Area of Cone');
The Surface Area of Cone is 1631919.15.>>
%Input here...
r=input('Enter the radius of the Cone:');
h=input('Enter the height of Cone:');
%Process here...
SA = pi*r*(r+h^2+r^2);
%Output here...
Surface Area of Sphere
clc;
Enter the radius of the Sphere: 45
disp('Surface Area of Sphere');
The Surface Area of Sphere is 25446.90.>>
%Input here...
r=input('Enter the radius of the Sphere:');
%Process here...
SA = 4*pi*r^2;
%Output here...
fprintf('The Surface Area of Sphere is
Surface Area of Rectangular Parallelepiped
clc;
Enter the of length Rectangular Parallelepiped: 24
disp('Surface Area of Rectangular
Enter the of width Rectangular Parallelepiped: 26
Parallelepiped');
Enter the of height Rectangular Parallelepiped: 35
%Input here...
l=input('Enter the of length Rectangular The Surface Area of Rectangular Parallelepiped is
4748.00.>>
Parallelepiped:');
w=input('Enter the of width Rectangular
Parallelepiped:');%Process here...
h=input('Enter the of height Rectangular
Parallelepiped:');
SA = 2*((w*l)+(h*l)+(h*w));
%Output here...
Surface Area of Right Circular Cylinder
clc;
Enter the of radius of Right Circular Cylinder: 23
disp('Surface Area of Right Circular
Enter the height of Right Circular Cylinder: 56
Cylinder');
The Surface Area of Right Circular Cylinder is
%Input here...
11416.55.>>
r=input('Enter the of radius of Right
Circular Cylinder:');
h=input('Enter the height of Right Circular
Cylinder:');
%Process here...
SA = (2*pi*r*h)+(2*pi*r^2);
%Output here...
clc;
disp('Surface Area of Cube');
%Input here...
a=input('Enter the of sides of Cube:');
%Process here...
SA = 6*a^2;
%Output here...
7. Conclusion:
CRITERIA
BEGINNER
ACCEPTABLE
PROFICIENT
Members
occasionally
demonstrate needed skills.
Experimental Set-up
Process Skills
Members
occasionally
demonstrate targeted process
skills.
I. Laboratory Skills
Manipulative
Skills
SCORE
Members
follow
safety
precautions most of the time.
Members
follow
safety
precautions at all times.
Time Management /
Members do not finish on time
Conduct
of
with incomplete data.
Experiment
Members
have
defined
responsibilities most of the
time.
Group conflicts are
cooperatively managed most
of the time.
Safety Precautions
II. Work Habits
Cooperative
Teamwork
and
Neatness
Orderliness
and
Ability
to
do
independent work
TOTAL SCORE
Other Comments / Observations:
TotalScore
RATING = (
24
Evaluated by:
Date:
) x 100%