CPT3701 Tutorial 3
CPT3701 Tutorial 3
Question 1
1.1. In the metric system, fluid flow is measured in cubic meters per second (m3/s). A cubic
foot per second (ft3/s) is equivalent to 0.028 m3/s. Write a m.file titled flowrate that
will prompt the user for flow in m3/s and will print the equivalent flow rate in ft3/s.
1.2. Working on the workspace plot exp(-x) for values of −1 ≤ 𝑥 ≤ 3 in steps of 0.2. Label
the x-axes, y-axes and title of the graph as x, y and Exp(-x).
(10)
[26 marks]
CPT3701_Tutorial 3
Question 2
2.1. Using OCTAVE solve 𝑥1 , 𝑥2 𝑎𝑛𝑑 𝑥3 for the following equations:
−2𝑥1 + 𝑥3 = −4
−3𝑥1 + 4𝑥2 − 2𝑥3 = 3
𝑥1 − 7𝑥2 − 5𝑥3 = 6
(10)
2.2. Figure 1 shows three reactors connected by pipes the volumetric flow rate is tabulated
in table 1:
Table 1
[24 marks]
Question 3
3.1. Create two column vectors T=[5:5:25]’ and S=[27:2:33]’. Then, by only using the name of the
vectors (T and S), create a column vector R that is made from the elements of T followed by
the elements of S.
(4)
3.2. Define the variables 𝑥 = 3.4 and 𝑦 = 5.8, and then use them to create a row vector (assign
it to a variable named e) that has the following elements: 𝑥⁄𝑦, 𝑥 + 𝑦, 𝑥 𝑦 , 𝑥 × 𝑦, 𝑦 2 and 𝑥.
(4)
3.3. Create a variable g that is a row vector in which the first element is 3 and the last element is
27, with an increment of 4 between the elements (3, 7, 11, … , 27).
(4)
3.4. Create the following matrix by typing one command. Do not type individual elements
explicitly
D=
1 1 1 1
1 1 1 1
1 1 1 1
8 6 4 2
(4)
3.5. Create the following matrix by typing one command. Do not type individual elements
explicitly
G=
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
0 0 0 1 1
0 0 0 1 1
0 0 0 1 1 (4)
3.6. Create the following three row vectors: a=[5 8 -1 0 2], b=[4 1 9 -2 3], and c=[-3 5 0 6 1].
CPT3701_Tutorial 3
3.7. Use the three vectors in a OCTAVE command to create a nine-element row vector consisting
from the first three elements of the vectors a, b, and c, respectively (i.e., 5 8 -1 4 1 9 -3 5 0).
(6)
3.8. (Use the three vectors in a OCTAVE command to create a nine-element column vector
consisting from the last three elements of the vectors a, b, and c, respectively
(4)
[30 MARKS]
Question 4
A thin nanosurface that has a single point exposed to an external source of heat at 600 ℃ together
with edges that are cooled to 5 ℃. After a while, the temperature will become constant throughout
the surface. Of course, the closer a point is to the source of heat, the hotter it will be, and the closer
a point is to an edge, the cooler it will be. For a steady state, you expect that the temperature at any
point to be the average of the temperatures around it. Using the an approximation, you get the
following results:
Where,
5 + 𝑡2 + 𝑡5 + 5
𝑡1 =
4
5 + 𝑡3 + 𝑡6 + 𝑡1
𝑡2 =
4
CPT3701_Tutorial 3
𝑡4 + 605 + 𝑡2
𝑡3 =
4
10 + 2𝑡3
𝑡4 =
4
𝑡1 + 𝑡6 + 𝑡7 + 5
𝑡5 =
4
𝑡2 + 600 + 𝑡8 + 𝑡5
𝑡6 =
4
𝑡5 + 𝑡8 + 𝑡9 + 5
𝑡7 =
4
2𝑡6 + 2𝑡7
𝑡8 =
4
2𝑡7 + 10
𝑡9 =
4