0% found this document useful (0 votes)
41 views5 pages

Bto1563 Lma3 TH22030 TH23036 231201 160834

This document contains student answers to test questions on computer programming for engineers. The answers demonstrate how to write MATLAB code to analyze liquid level data, identify overpressurized sensors, validate pH values, and calculate heat capacity and change in internal energy using symbolic equations and integrals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views5 pages

Bto1563 Lma3 TH22030 TH23036 231201 160834

This document contains student answers to test questions on computer programming for engineers. The answers demonstrate how to write MATLAB code to analyze liquid level data, identify overpressurized sensors, validate pH values, and calculate heat capacity and change in internal energy using symbolic equations and integrals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

OVERALL MARKS:

FACULTY OF CHEMICAL & PROCESS


ENGINEERING TECHNOLOGY
SEMESTER I 2023/2024
BTO1563 COMPUTER FOR ENGINEERS
TEST 1
Instructions: Copy your answers from MATLAB environment directly into this document.
Please rename your file accordingly and save it in pdf format. i.e.: BTO1563_TEST1_IDs

NAME
FATIN AINAAFIQAH BINTI OMAR
STUDENT ID
TH22030

NAME
SHAIFFAH BINTI SHAMSUDDIN
STUDENT ID
TH23036
ANSWER FOR QUESTION 1:

1(a)

START

VERY LOW
IF L < 10 LIQUID LEVEL

LOW LIQUID
IF L <20 LEVEL

EMERGENCY
IF L > 95 SHUTDOWN

IF L > 90 VERY HIGH


LIQUID LEVEL

HIGH LIQUID
IF L > 80
LEVEL

NO ALARM

END
(b)
%LMA3
%Q1a (b)
% Liquid level (L%) input
L = input('Enter liquid level percentage: ');

if L < 10
disp('Very Low Liquid Level')
elseif L < 20
disp('Low Liquid Level')
elseif L > 95
disp('Emergency Shutdown')
elseif L > 90
disp('Very High Liquid Level')
elseif L > 80
disp('High Liquid Level')
else
disp('No Alarm')
end

1(b)
% Pressure values for different sensors
pressure_values = [99 40 43 20 50 39 60 29 20 10 5 60 80];

% Find pressure sensors exceeding 45 kPa


overpressurized_sensors_indices = find(pressure_values > 45);
overpressurized_sensors_values =
pressure_values(overpressurized_sensors_indices);

fprintf('These are the list of pressure sensors that exceed 45 kPa:\n');


for i = 1:length(overpressurized_sensors_indices)
fprintf('Pressure sensor #%d is %d kPa\n',
overpressurized_sensors_indices(i), overpressurized_sensors_values(i));
end

fprintf('This is the total number of pressure sensors that


overpressurize: %d\n', length(overpressurized_sensors_indices));
ANSWER FOR QUESTION 2:

(a)
% Part (a)
pH = input('When prompted, enter a pH value ranging from 1 to 14\nEnter a
pH value: ');

while pH < 1 || pH > 14


disp('Error! Enter a pH value ranging from 1 to 14 only: ');
pH = input('Enter a pH value: ');
end

fprintf('The pH value entered is %.2f\n', pH);

(b)
% Part (b)
for i = 1:3
pH = input('When prompted, enter a pH value ranging from 1 to
14\nEnter a pH value ranging from 1 to 14 only: ');

if pH < 0
disp('You must enter a positive pH value');
disp('This program will be terminated');
break;
end

if pH == 7
disp('The solution is neutral');
elseif pH > 7
disp('The solution is basic');
else
disp('The solution is acidic');
end
end
ANSWER FOR QUESTION 3:

(a)

syms T a b Cv

Cv = a + b*T;

% Solve the equation for T


T_solution = solve(Cv - T, T);
disp('Symbolic equation for heat capacity (Cv):');
disp(Cv);
disp('Solved equation for T:');
disp(T_solution);

(b)

% Given values
a = 0.855;
b = 9.42e-4;
Cp = 121; % kJ/kg

syms T
Cv = a + b*T;
T_solution = solve(Cv - (Cp * 1000), T); % Convert Cp to J/kg

disp('Solved temperature (T) for given Cv and Cp:');


disp(double(T_solution));

(c)
% Given temperature
T_initial = 20; % in °C
T_final = 150; % in °C

Cv = @(T) a + b*T;
delta_H = integral(Cv, T_initial, T_final);

disp('Change in internal energy (Delta H):');


disp(delta_H)

You might also like