KWAME NKRUMAH UNIVERSITY OF SCIENCE AND TECHNOLOGY
COLLEGE OF ENGINEERING
DEPARTMENT OF CHEMICAL ENGINEERING
COMPUTER APPLICATIONS FOR ENGINEERS (CHE 261)
Tutorial 2: Array creation and address
Activity 1
Switch on your diary
Activity 2
Question 1
1.a Create a variable a that is a row vector with the following elements: 9, 1, 32,
7/4, 0, 2.25 × 8.5, 0.8, and 𝑠𝑖𝑛(𝜋/8) .
1.b Create a vairable c that is a column vector with the following elements:
2.1 × 10−2 , 𝑠𝑖𝑛(1.7𝜋), 28.5, 2.74/3 , 𝑎𝑛𝑑 𝑒 3 .
1.c Define the variables d=4,5 and e=2.8, and then use them to create the colunm vector
(assign to variable named f) that has the following elements:
𝑒 2 , 𝑑, (𝑑 + 𝑒), 𝑑𝑒 , 𝑎𝑛𝑑 𝑒.
1.d 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.
1.e Create two row vectors v=41:-3:29 and w=17:4:37. Then, by only using the name of the
vectors (v and w), create a row vector u that is made from the elements of w followed by the
elements of v.
1.f 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.
Question 2
i.
ii.
iii.
iv.
Activity 3
Turn off your dairy
Clear your workspace
Clear the command window
Activity 4
Question 1
Question 2