PPE-309L Process Lab: Engineering Computing
PPE-309L Process Lab: Engineering Computing
Engineering Computing
Lab
2020 Fall-5th Semester
Instructor: Ms. Komal Naveed
Email id: [email protected]
Designation: Graduate assistant
University of Engineering and Technology Lahore
Conditional statements
Solution with MATLAB
Create an M-file
Save the file with the name of abs_num
Write the following script
%%%%prompt the user for a number and print its absolute
num=input('please enter a number:');
Writing a script %%%if the user entered the negative number, change it
to return the if num > 0
number=num
absolute value end
of a number if num < 0
disp('ok,the number is negative, we will use the absolute
number')
number = abs(num)
end
To run the script abs_num, type abs_num in the
command window and press enter
You will be asked to enter your number
Writing a script
to return the
absolute value
of a number
Tutorial #1
Question#1
Estimate the molecular weight of an oil fraction that has an
average boiling point of 344.7°C and an API gravity of 50.
Plot a graph M vs.T (400 < Tb< 600 K) with API gravity = 20, 40,
and 60.
Part a)
TB=344.7+273 %Boiling Temperature in kelvin