Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

FACULTY OF CHEMICAL & PROCESS

ENGINEERING TECHNOLOGY
SEMESTER II 2023/2024
BTO1563 COMPUTER FOR ENGINEERS
CLASS EXERCISE 4

Example 1

This problem requires you to generate temperature conversion tables. Use the following
equations, which describe the relationships between temperatures in degrees Fahrenheit 1TF2,
degrees Celsius 1TC2, kelvins 1TK2, and degrees Rankine 1TR2, respectively:

You will need to rearrange these expressions to solve some of the problems.
(a) Generate a table of conversions from Fahrenheit to Kelvin for values from 0°F to 200°F.
Allow the user to enter the increments in degrees F between lines. Use disp and fprintf
to create a table with a title, column headings, and appropriate spacing.
(b) Generate a table of conversions from Celsius to Rankine. Allow the user to enter the
starting temperature and the increment between lines, and final value. Use disp and
fprintf to create a table with a title, column headings, and appropriate spacing.
(c) Generate a table of conversions from Celsius to Fahrenheit. Allow the user to enter the
starting temperature, the increment between lines, and the number of lines for the table.
Use disp and fprintf to create a table with a title, column headings, and appropriate
spacing.

%% CH2 PB1
start = 0;
stop = 200;
incr = input('Enter the temperature increment ');
F=start:incr:stop;
K = (F+459.6)*5/9;
disp('Temperature Conversions')
disp(' F K')
fprintf('%5.0f %8.2f \n', [F;K])
%b
start = input('Enter the starting temperature ');
incr = input('Enter the increment ');
stop = start +incr*24;
C = start:incr:stop;
R = (C + 273)*9/5;
disp('Temperature Conversion')
disp(' C R')
fprintf('%5.0f %8.2f \n',[C;R])
%c
start = input('Enter the starting temperature ')
incr = input('Enter the increment ')
num = input('Enter the number of lines ')
stop = start + incr*(num-1);
C = start:incr:stop;
F = 9/5*C + 32;
disp('Temperature Conversion')
disp(' C F')
fprintf('%5.0f %8.2f \n',[C;F])
Exercise 1

Engineers use both English and SI (Système International d’Unités) units on a regular basis.
Some fields use primarily one or the other, but many combine the two systems. For example,
the rate of energy input to a steam power plant from burning fossil fuels is usually measured in
Btu/hour. However, the electricity produced by the same plant is usually measured in joules/s
(watts). Automobile engines, by contrast, are often rated in horsepower or in ft lbf/s. Here are
some conversion factors relating these different power measurements:

(a) Generate a table of conversions from kW to hp. The table should start at 0 kW and end
at 15 kW. Use the input function to let the user define the increment between table
entries. Use disp and fprintf to create a table with a title, column headings, and
appropriate spacing.

(b) Generate a table of conversions from ft lbf>s to Btu/h. The table should start at 0 ft lbf/s
but let the user define the increment between table entries and the final table value. Use
disp and fprintf to create a table with a title, column headings, and appropriate spacing.

(c) Generate a table that includes conversions from kW to Btu/h, hp, and ft lbf/s. Let the
user define the initial value of kW, the final value of kW, and the number of entries in
the table. Use disp and fprintf to create a table with a title, column headings, and
appropriate spacing.

You might also like