Professional 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:
Course: CHE 205 Prelim Exam
Group No.: Section: CH22FA1
Group Members: Manabat, Patricia Anne F. Date Performed: December 16,2019
Date Submitted:
Instructor: Engr. Crispulo G. Maranan
6. Data and Results:
ANACHEM PROBLEM 1
What is the mass of solute in a 100 g of a solution that is 0.5% phenolphthalein by
mass?
Enter the mass percent:.5
Enter the mass of solution:100
The mass of solute is 0.50.>>
2 Clc;
disp('ANACHEM PROBLEM 2 ');
disp('What is the Volume of reagent in preparing 1.0 L of a 0.10 M solution of
sulfuric acid from a 3.0 M solution of sulfuric acid ');
msoln=input('Enter the molarity of concentrated solution:');
mdil=input('Enter the molarity of diluted solution:');
vdil=input('Enter the volume of diluted solution:');
vreagent=(mdil*vdil)/msoln;
fprintf('The volume of reagent is %0.2f.',vreagent);
ANACHEM PROBLEM 2
What is the Volume of reagent in preparing 1.0 L of a 0.10 M solution of sulfuric
acid from a 3.0 M solution of sulfuric acid
Enter the molarity of concentrated solution:3
Enter the molarity of diluted solution:.1
Enter the volume of diluted solution:1
The volume of reagent is 0.03.>>
3 Clc;
disp('ANACHEM PROBLEM 3 ');
disp('500 mL of a 1.0 M solution of potassium chloride that is 93.0% pure. How
much mass of impure potassium chloride is needed. The gram formula weight of
potassium chloride is 74.56 g/mol. ');
msoln=input('Enter the molarity of solution:');
v=input('Enter the volume of solution in Liters:');
mw=input('Enter the molecular weight of potassium chloride:');
pp=input('Enter the percent purity of the solution:');
m=(msoln*v*mw)/(pp/100);
fprintf('The the mass of impure potassium chloride is %0.2f.',m);
ANACHEM PROBLEM 3
500 mL of a 1.0 M solution of potassium chloride that is 93.0% pure. How much
mass of impure potassium chloride is needed. The gram formula weight of
potassium chloride is 74.56 g/mol.
Enter the molarity of solution:1
Enter the volume of solution in Liters:.5
Enter the molecular weight of potassium chloride:74.56
Enter the percent purity of the solution:93
The the mass of impure potassium chloride is 40.09.>>
4 Clc;
disp('MATHEMATICS IN THE MODERN WORLD PROBLEM 1');
disp('Area of the Oblique Triangle');
a=input('Enter the length of side a of the oblique triangle:');
b=input('Enter the length of side b of the oblique triangle: ');
c=input('Enter the length of side c of the oblique triangle: ');
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
fprintf('The area of the oblique triangle is %0.2f.',area);
5 clc;
disp('MATHEMATICS IN THE MODERN WORLD PROBLEM 2');
disp('What is the value of x + (x+x 2) when x = 2 ');
a=input('Enter the value of x:');
value= a+(a+a^2);
fprintf('The value is %0.2f.',value);
6 clc;
disp('MATHEMATICS IN THE MODERN WORLD PROBLEM 3');
disp('A salesman sold twice as much pears in the afternoon than in the morning. If
he sold 360 kilograms of pears that day, how many kilograms did he sell in the
afternoon? ');
a=input('Enter the kilogram of pears that he sold that day:');
value= a/3 ;
fprintf('The kilogram that he sold in the afternoon is %0.2f.',value);
7 clc;
disp('PHYSICS PROBLEM 1');
disp('The distance light travels in one year is approximately 5,870,000,000,000
miles. What is the distance light travels in 100 years?');
a=input('Enter the distance light travels in one year:');
b=input('Enter the number of years needed:');
value= a*b ;
fprintf('The distance of the light travels in 100 years is %0.2f.',value);
PHYSICS PROBLEM 1
The distance light travels in one year is approximately 5,870,000,000,000 miles.
What is the distance light travels in 100 years?
Enter the distance light travels in one year:5870000000000
Enter the number of years needed:100
The distance of the light travels in 100 years is 587000000000000.00.>>
8 clc;
disp('PHYSICS PROBLEM 2');
disp('An airplane accelerates down a runway at 3.20 m/s 2 for 32.8 s until is finally
lifts off the ground. Determine the distance traveled before takeoff. ');
a=input('Enter the acceleration:');
b=input('Enter the time:');
c=input('Enter the initial velocity:');
value=c*b+(.5*a*b^2) ;
fprintf('The distance travelled before takeoff is %0.2f.',value);
PHYSICS PROBLEM 2
An airplane accelerates down a runway at 3.20 m/s2 for 32.8 s until is finally lifts
off the ground. Determine the distance traveled before takeoff.
Enter the acceleration:3.2
Enter the time:32.8
Enter the initial velocity:0
The distance travelled before takeoff is 1721.34.>>
9 clc;
disp('PHYSICS PROBLEM 3');
disp('A race car accelerates uniformly from 18.5 m/s to 46.1 m/s in 2.47 seconds.
Determine the acceleration of the car and the distance traveled. ');
a=input('Enter the initial velocity:');
b=input('Enter the time:');
c=input('Enter the final velocity:');
value=(c-a)/b ;
fprintf('The acceleration is %0.2f.',value);
PHYSICS PROBLEM 3
A race car accelerates uniformly from 18.5 m/s to 46.1 m/s in 2.47 seconds.
Determine the acceleration of the car and the distance traveled.
Enter the initial velocity:18.5
Enter the time:2.47
Enter the final velocity:46.1
The acceleration is 11.17.>>
10 clc;
disp('GENERAL CHEMISTRY PROBLEM 1');
disp('What is the volume in liters of a rectangular tank which measures 2.0 m by 50
cm by 200 mm?');
b=input('Enter the first value :');
c=input('Enter the second value :');
a=input('Enter the last value :');
value=((a*100)*b*(c/10))/1000 ;
fprintf('The volume is %0.2f.',value);
4.5 clc;
disp('Perimeter of the Circle');
radius=input('Enter the radius of the circle:');
circumference=2*pi*radius;
fprintf('The perimeter of the circle is %0.2f.',circumference);
4.6 clc;
disp('Perimeter of the Ellipse');
a=input('Enter the radius of the x-axis of the circle:');
b=input('Enter the radius of the y-axis of the circle:');
circumference=2*pi*sqrt(((a^2)+(b^2))/2);
fprintf('The approximate perimeter of the ellipse is %0.2f.',circumference);
5.2 clc;
disp('Volume of the Sphere');
radius=input('Enter the radius of the sphere:');
volume=(4/3)*pi*(radius^3);
fprintf('The volume of the cone is %0.2f.',volume);
5.3 clc;
disp('Volume of the Rectangular Parallelepiped');
width=input('Enter the width of the rectangular parallelepiped:');
height=input('Enter the height of the rectangular parallelepiped: ');
length=input('Enter the length of the rectangular parallelepiped: ');
volume=width*height*length;
fprintf('The volume of the rectangular parallelepiped is %0.2f.',volume);
5.4 clc;
disp('Volume of the Right Circular Cylinder');
radius=input('Enter the radius of the right circular cylinder:');
height=input('Enter the height of the right circular cylinder: ');
volume=pi*(radius^2)*height;
fprintf('The volume of the right circular cylinder is %0.2f.',volume);
6.1 clc;
disp('Surface area of the Cone');
radius=input('Enter the radius of the cone:');
height=input('Enter the height of the cone: ');
surfacearea=pi*radius*(radius+sqrt(height^2+radius^2));
fprintf('The surface area of the cone is %0.2f.',surfacearea);
6.2 clc;
disp('Surface area of the Sphere');
radius=input('Enter the radius of the sphere:');
surfacearea=4*pi*radius^2;
fprintf('The surface area of the sphere is %0.2f.',surfacearea);
6.3 clc;
disp('Surface area of the Rectangular Parallelepiped');
w=input('Enter the width of the rectangular parallelepiped:');
l=input('Enter the length of the rectangular parallelepiped:');
h=input('Enter the height of the rectangular parallelepiped:');
surfacearea=2*(w*l+h*l+h*w);
fprintf('The surface area of the rectangular parallelepiped is %0.2f.',surfacearea);
6.5 clc;
disp('Surface area of a Cube');
e=input('Enter the edge of the cube:');
surfacearea=6*e^2;
fprintf('The surface area of cube is %0.2f.',surfacearea);
7 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);
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);
end;
8 clc;
disp('Area and Perimeter of the Rectangle:');
choose=input('\n 1. Plane Figures \n 2. Solid Figures \n Choose 1 or 2: ');
switch(choose)
case 1;
pick=input('\n 1. Square \n 2. Rectangle \n 3. Right Triangle \n 4. Oblique
Triangle \n 5. Circle \n 6. Ellipse \n Choose 1, 2, 3, 4, 5, or 6: ');
switch(pick)
case 1;
identify=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Area of the Square');
length=input('Enter the length of the side:');
area=length^2;
fprintf('The area of the square is %0.2f.',area);
case 2;
disp('Perimeter of the Square');
length=input('Enter the length of the side of the square:');
area=length*4;
fprintf('The perimeter of the square is %0.2f.',area);
end;
case 2;
identify=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Area of the Rectangle');
length=input('Enter the length of the reactangle:');
width=input('Enter the width of the rectangle:');
area=length*width;
fprintf('The area of the rectangle is %0.2f.',area);
case 2;
disp('Perimeter of the Rectangle');
length=input('Enter the length of the reactangle:');
width=input('Enter the width of the rectangle:');
perimeter=2*(length+width);
fprintf('The area of the rectangle is %0.2f.',perimeter);
end;
case 3;
identify=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Area of the Right Triangle');
base=input('Enter the base of the right triangle:');
height=input('Enter the height of the right triangle:');
area=(base*height)/2;
fprintf('The area of the right triangle is %0.2f.',area);
case 2;
disp('Perimeter of the Right Triangle');
short=input('Enter the length of the short side of the right triangle:');
medium=input('Enter the length of the medium side of the right triangle:');
perimeter=medium+short+sqrt((short^2)+(medium^2));
fprintf('The perimeter of the right triangle is %0.2f.',perimeter);
end;
case 4;
identify=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Area of the Oblique Triangle');
a=input('Enter the length of side a of the oblique triangle:');
b=input('Enter the length of side b of the oblique triangle: ');
c=input('Enter the length of side c of the oblique triangle: ');
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
fprintf('The area of the oblique triangle is %0.2f.',area);
case 2;
disp('Perimeter of the Oblique Triangle');
a=input('Enter the length of side a of the oblique triangle:');
b=input('Enter the length of side b of the oblique triangle: ');
c=input('Enter the length of side c of the oblique triangle: ');
perimeter=(a+b+c);
fprintf('The perimeter of the oblique triangle is %0.2f.',perimeter);
end;
case 5;
identify=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Area of the Circle');
radius=input('Enter the radius of the circle:');
area=pi*(radius^2);
fprintf('The area of the circle is %0.2f.',area);
case 2;
disp('Perimeter of the Circle');
radius=input('Enter the radius of the circle:');
circumference=2*pi*radius;
fprintf('The perimeter of the circle is %0.2f.',circumference);
end;
case 6;
identify=input('\n 1. Area \n 2. Perimeter \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Area of the Ellipse');
a=input('Enter the radius of the x-axis of the circle:');
b=input('Enter the radius of the y-axis of the circle:');
area=pi*a*b;
fprintf('The area of the ellipse is %0.2f.',area);
case 2;
disp('Perimeter of the Ellipse');
a=input('Enter the radius of the x-axis of the circle:');
b=input('Enter the radius of the y-axis of the circle:');
circumference=2*pi*sqrt(((a^2)+(b^2))/2);
fprintf('The approximate perimeter of the ellipse is %0.2f.',circumference);
end;
end;
case 2;
pick=input(' \n 1. Cone \n 2. Sphere \n 3. Rectangular Parellelepiped \n 4.
Right Circular Cylinder \n 5. Cube \n Choose 1, 2, 3, 4, or 5: ');
switch(pick)
case 1;
identify=input('\n 1. Volume \n 2. Surface Area \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Volume of the Cone');
radius=input('Enter the radius of the cone:');
height=input('Enter the height of the cone:');
volume=pi*(radius^2)*(height/3);
fprintf('The volume of the cone is %0.2f.',volume);
case 2;
disp('Surface area of the Cone');
radius=input('Enter the radius of the cone:');
height=input('Enter the height of the cone: ');
surfacearea=pi*radius*(radius+sqrt(height^2+radius^2));
fprintf('The surface area of the cone is %0.2f.',surfacearea);
end;
case 2;
identify=input('\n 1. Volume \n 2. Surface Area \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Volume of the Sphere');
radius=input('Enter the radius of the sphere:');
volume=(4/3)*pi*(radius^3);
fprintf('The volume of the cone is %0.2f.',volume);
case 2;
disp('Surface area of the Sphere');
radius=input('Enter the radius of the sphere:');
surfacearea=4*pi*radius^2;
fprintf('The surface area of the sphere is %0.2f.',surfacearea);
end;
case 3;
identify=input('\n 1. Volume \n 2. Surface Area \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Volume of the Rectangular Parallelepiped');
width=input('Enter the width of the rectangular parallelepiped:');
height=input('Enter the height of the rectangular parallelepiped: ');
length=input('Enter the length of the rectangular parallelepiped: ');
volume=width*height*length;
fprintf('The volume of the rectangular parallelepiped is %0.2f.',volume);
case 2;
disp('Surface area of the Rectangular Parallelepiped');
w=input('Enter the width of the rectangular parallelepiped:');
l=input('Enter the length of the rectangular parallelepiped:');
h=input('Enter the height of the rectangular parallelepiped:');
surfacearea=2*(w*l+h*l+h*w);
fprintf('The surface area of the rectangular parallelepiped is %0.2f.',surfacearea);
end;
case 4;
identify=input('\n 1. Volume \n 2. Surface Area \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Volume of the Right Circular Cylinder');
radius=input('Enter the radius of the right circular cylinder:');
height=input('Enter the height of the right circular cylinder: ');
volume=pi*(radius^2)*height;
fprintf('The volume of the right circular cylinder is %0.2f.',volume);
case 2;
disp('Surface area of the Right Circular Cylinder');
r=input('Enter the radius of the right circular cylinder:');
h=input('Enter the height of the right circular cylinder:');
surfacearea=2*pi*r*h+2*pi*r^2;
fprintf('The surface area of the right circular cylinder is %0.2f.',surfacearea);
end;
case 5;
identify=input('\n 1. Volume \n 2. Surface Area \n Choose 1 or 2: ');
switch(identify)
case 1;
disp('Volume of the Cube');
radius=input('Enter the edge of the cube:');
volume=radius^3;
fprintf('The volume of the cube is %0.2f.',volume);
case 2;
disp('Surface area of a Cube');
e=input('Enter the edge of the cube:');
surfacearea=6*e^2;
fprintf('The surface area of cube is %0.2f.',surfacearea);
end;
end;
end;
1. Plane Figures
2. Solid Figures
Choose 1 or 2: 1
1. Square
2. Rectangle
3. Right Triangle
4. Oblique Triangle
5. Circle
6. Ellipse
Choose 1, 2, 3, 4, 5, or 6: 1
1. Area
2. Perimeter
Choose 1 or 2: 1
Area of the Square
Enter the length of the side:4
The area of the square is 16.00.>>
1. Plane Figures
2. Solid Figures
Choose 1 or 2: 1
1. Square
2. Rectangle
3. Right Triangle
4. Oblique Triangle
5. Circle
6. Ellipse
Choose 1, 2, 3, 4, 5, or 6: 2
1. Area
2. Perimeter
Choose 1 or 2: 1
Area of the Rectangle
Enter the length of the reactangle:6
Enter the width of the rectangle:9
The area of the rectangle is 54.00.>>
1. Plane Figures
2. Solid Figures
Choose 1 or 2: 1
1. Square
2. Rectangle
3. Right Triangle
4. Oblique Triangle
5. Circle
6. Ellipse
Choose 1, 2, 3, 4, 5, or 6: 2
1. Area
2. Perimeter
Choose 1 or 2: 2
Perimeter of the Rectangle
Enter the length of the reactangle:.4
Enter the width of the rectangle:5
The area of the rectangle is 10.80.>>
7. Conclusion:
I therefore conclude that this lab experiment was able to help us in creating a program that will calculate
the area, perimeter, surface area and volume. By just entering the values using the correct program, you
can easily solve for area, perimeter, surface area and volume, whether it is plane figure or solid figure.