Sei sulla pagina 1di 8

Course: CHE 508 Laboratory Exercise No.

: 3
Group No. Section: CH 51FA2
Group Members: Date Performed: December 14, 2018
MAGNO, Lavenia Alou C. Date Submitted: January 5, 2019
Instructor: Engr. Crispulo Maranan

Create a Chemical Engineering problem solver using Matlab where the user is asked to choose
from the three choices about three different courses. Choosing a course, the user is then asked to
choose from three different problems about the chosen course. Choosing a certain problem from
the four choices, the student is then asked to input the data needed to solve the problem. The user
will then be asked if he/she wants to continue. If yes, the user is prompted to choose one from
the three courses. If no, the program will exit.

OVERALL CODE

MAGNOCourse1Prob1;
clc;
disp('Physical Chemistry 1');
disp('Problem 1: The air in a room is at 39 degree celcius and a total pressure of 101.3 kPa abs
containing water vapor with a partial pressure P= 3.9 kPa. Calculate the Humidity.');

A=input('Enter the pressure of water:'); B=input('Enter the total pressure:');


humidity = (18*A)/((B-A)*29);
fprintf('The humidity obtained in the system is %0.2f kg H20/kg Dry Air. ',humidity );

MAGNOCourse1Prob2;
clc;
disp('Physical Chemistry 1');
disp('Problem 2: Determine the volume of Nitrogen gas in STP.');
A=input('Enter the pressure of Nitrogen:');
B=input('Enter the temperature:');
C=input('Enter the Molecular Weight of Nitrogen:');
volume = (A*C)/(0.08206*B); fprintf('The volume obtained of the Nitrogen gas is %0.2f L.
',volume );
MAGNOCourse1Prob3;
clc;
disp('Physical Chemistry 1);
disp('Problem 3: What is the molecular weight of a gas in a pressure of 3 atm with a volume of
23.7 L at 431.15 kelvin?');
A=input('Enter the pressure of Nitrogen:');
B=input('Enter the temperature:');
C=input('Enter the volume of the gas:');
mw = (C*0.08206*B)/A;
fprintf('The molecular weight of the gas is %0.2f g/mol. ',mw );

MAGNOCourse2Prob1;
clc;
disp('Thermodynamics 1');
disp('Problem 1: The mass of a fluid system is 0.512 slug, its density is 41lb/ft^3 and gravity is
31.90fps^2. Find the specific volume.');
A=input('Enter the density in the system:');
Density = 1/A ; fprintf('The specific volume is %0.2f ft^3/lb. ',Density );

MAGNOCourse2Prob2;
clc;
disp('Thermodynamics 1');
disp('Problem 2: What is the heat obtain in the system given the mass of 7 kg , the heat capacity
of water is 4.187 kJ/kgK with the change of temperature from 334.15 k to 789.71k.');
A=input('Enter the mass in the system:');
B=input('Enter the cp of water in the system:');
C=input('Enter the intial temperature in the system:');
D=input('Enter the final temperature in the system:');
heat = A*B*(D-C); fprintf('The heat obtained in the system is %0.2f KJ. ',heat );

MAGNOCourse2Prob3;
clc;
disp('Thermodynamics 1');
disp('Problem 3: A balloon filled with gas expands its volume by 5.0 L. If the pressure outside
the balloon is 0.87 bar and the energy change of the gas is 320 J, how much heat did the
surroundings give the balloon?');
disp('Remember that 100 Joule = 1 L*bar.');
A=input('Enter the energy change in the system:');
B=input('Enter the pressure in the system:');
C=input('Enter volume in the system:'); heat = A+(B*C*100); fprintf('The heat obtained in the
system is %0.2f Joule. ',heat );

MAGNOCourse3Prob1;
clc;
disp('General Chemistry Calculations');
disp('Problem 1: Determine the Molarity of solution given that 0.305 mol and 0.98 L of
solution?'); A=input('Enter the moles:'); B=input('Enter the volume:');
M = A/B;
fprintf('The molarity of the solution is %0.2f. ',M );

MAGNOCourse3Prob2;
clc;
disp('General Chemistry Calculations');
disp('Problem 2: Determine the moles of Nitrogen having the mass of 50 grams of NOH?');
A=input('Enter the molecular weight of Nitrogen:'); B=input('Enter the mass of NOH:');
M = B/A;
fprintf('The moles of nitrogen is %0.2f mol. ',M );
clc;

MAGNOCourse3Prob3;
disp('General Chemistry Calculations');
disp('Problem 2: How many atoms are in 0.2342 mole sample of sodium (Na)?');
A=input('Enter the mole of Sodium:');
M = A*6.022E23;
fprintf('The number of atoms of sodium is %0.2f atoms. ',M );
clc;
disp('Chemical Engineering Course Sample Questions');
choose=input('\n 1. Physical Chemistry 1 2. Thermodynamics 1 3.General Chemistry
Calcculations \n \n Choose: ');
switch(choose)

case 1

disp(Physical Chemistry 1:');


choose=input('\n 1. First Problem 2. Second Problem 3.Third Problem \n \n Choose: ');
switch(choose)
case 1
MAGNOCourse1Prob1;
('Do you still want to proceed?:');
choose=input('\n 1. Yes 2. No \n Choose: ');
switch(choose)
case 1
MAGNOPrelimExam;
fprintf(' \n \n');
case 2
exit;

end
case 2

MAGNOCourse1Prob2;
('Do you still want to proceed?:');
choose=input('\n 1. Yes 2. No \n Choose: ');
switch(choose)

case 1

MAGNOPrelimExam;
fprintf(' \n \n');
case 2
exit;

end
case 3

MAGNOlCourse1Prob3;
disp('Do you still want to proceed?:');
choose=input('\n 1. Yes 2. No \n Choose: ');
switch(choose)

case 1

MAGNOPrelimExam

fprintf(' \n \n');
case 2
exit;

end

end
case 2

disp(‘Thermodynamics 1');
choose=input('\n 1. First Problem 2. Second Problem 3. Third Problem \n \n Choose: ');
switch(choose)
case 1

MAGNOCourse2Prob1;
disp('Do you still want to proceed?:'); choose=input('\n 1. Yes 2. No \n Choose: ');
switch(choose)

case 1

MAGNOPrelimExam;
fprintf(' \n \n');
case 2
exit;
end
case 2

MAGNOCourse2Prob2;
disp('Do you still want to proceed?:');
choose=input('\n 1. Yes 2. No \n Choose: ');
switch(choose)
case 1

MAGNOPrelimExam;
fprintf(' \n \n');
case 2
exit;

end
case 3

MAGNOCourse2Prob3;
disp('Do you still want to proceed?:');
choose=input('\n 1. Yes 2. No \n Choose: ');
switch(choose)

case 1

MAGNOPrelimExam;
fprintf(' \n \n');
case 2
exit;

end

end

case 3

disp('General Chemistry Equations 1:');


choose=input('\n 1. First Problem 2. Second Problem 3. Third Problem \n \n Choose: ');

switch(choose)
case 1

MAGNOCourse3Prob1;
disp('Do you still want to proceed?:');
choose=input('\n 1. Yes 2. No \n Choose: '); switch(choose)
case 1

MAGNOPrelimExam;
fprintf(' \n \n');
case 2
exit;
end
case 2
MAGNOCourse3Prob1;
disp('Do you still want to proceed?:');
choose=input('\n 1. Yes 2. No \n Choose: ');
switch(choose)
case 1

MAGNOPrelimExam;
fprintf(' \n \n');
case 2
exit;
end

case 3
MAGNOCourse3Prob3;
disp('Do you still want to proceed?:');
choose=input('\n 1. Yes 2. No \n Choose: ');
switch(choose)

case 1

MAGNOPrelimExam
fprintf(' \n \n'); case 2

exit;
end
end
end
Sample Execution

Potrebbero piacerti anche