Computer Programming for Engineers, BKF 2143
Semester 1, 2019/20
Assignment 2
Question 1:
1) Figure 1 shows the command window results obtained from the data shown in Table 1.
Create the MATLAB® code for displaying pressure value demonstrated by different
pressure sensor of a chemical plant unit as shown in Figure 1. Table 1: Pressure sensor
vs Value (kPa)
Pressure
sensor
1 2 3 4 5 6 7 8 9 10 11 12 13
Value
(kPa)
99 40 43 20 50 39 60 29 20 10 5 60 80
Figure 1: Results shown in command window
(9 marks)
Question 2:
Consider that an acceptable temperature in between 200°C and 250°C for a distillation column.
Write the MATLAB’s code using if command for the problem that specifies that the
temperature of a distillation column shows
• Temperature within specified range
• The temperature has exceeded maximum value
• The temperature is below the operating range
(7 marks)
Question 3
Consider a chemical company has a balance of money of $50k before closing down. The
company plan to invest that amount of money in a third party company that generates a return
of 8% annually.
a) Write a MATLAB code using while loop to show how many years are needed to reach
$1million.
(6 marks)
b) Using fplot code to plot money vs the number of years that reach $1million from $50k
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |