Tutorial Programming

You might also like

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

CES 513/512 SUPPLEMENTARY LAB SHEET DOCUMENT (LAB 2)

NAME OF STUDENT: NURSYAZANA AFIQAH BINTI MOHD NAZRI


GROUP: PEC2216D2
DATE: 09 APRIL 2023

Level of Openness: 1 (33%)

Learning Outcomes

At the end of the laboratory activities, students would be able to:


 to create matrix (row and column) with certain dimension (CO2:PO5)
 to create n x n matrix (CO2:PO5)
 to perform matrix mathematical operations (addition, subtraction, multiplication,
division) (CO2:PO5)
 to use special matrix MATLAB command (eye, magic) (CO2:PO5)
 to extract certain element in matrix(CO2:PO5)

PROBLEM FOR LAB 2

PROBLEM 1

Given a Table 1 of a data for the human population from the year of 1984 to 1996.

Year 1984 1986 1988 1990 1992 1994 1996


Population 127 130 136 145 158 178 211
(in million)

a) Create separate row matrix in MATLAB for storing the year and the population

b) Create separate column matrix in MATLAB for storing the year and population

c) Using a constant spacing, write the same arrays in a) in MATLAB


d) Using MATLAB, compute the maximum, mean and the summation of the population

PROBLEM 2

a) Create the following matrices using MATLAB, denoting that to set all matrix location as
zeros.
5 12
1 7
−3
𝐴=[ 2]
6 −10
3
11 5 3
𝐵=[ ]
2 6.54 1
7 14 1
𝐶 = [10 3 −2]
8 −5 9

b) Using MATLAB, compute A+C and C-A

c) Using MATLAB, calculate 5B


d) Using MATLAB, determine AB and BA

e) Using MATLAB, solve 3.2(A+C) and 3.2A + 3.2C

f) Using MATLAB, determine AB, A-B and A+B

g) Add an identity matrix of same dimension with matrix A with matrix A


h) Multiply magic matrix with matrix C with MATLAB

i) Perform multiplication, division, exponential elementwise operation on matrices A and C

PROBLEM 3

The axial force, Fi, in each of the 13 member pin connected truss, can be calculated by solving the
following system of 13 equations;

F2 +0.7071F1 =0

-F2 +F6 =0

F3 -2000 =0

F4 +0.6585F3 -0.7071 F1 =0

0.7071F1 +F4 +0.7526F3 +1000 =0

F7 +0.6585F8 –F4 =0

0.7526F8 +F9 +500 =0

F10 -0.6585F5 –F6 =0

F9 +0.7526F5 -4000=0

0.7071F11 –F7 =0
PROBLEM LAB 2

PROBLEM 1

a) Create separate row matrix in MATLAB for storing the year and the population

b) Create separate column matrix in MATLAB for storing the year and population

c) Using a constant spacing, write the same arrays in a) in MATLAB


d) Using MATLAB, compute the maximum, mean and the summation of the population
PROBLEM 2

a) Create the following matrices using MATLAB, denoting that to set all matrix location as zeros

b) Using MATLAB, compute A+C and C-A


c) Using MATLAB, determine AB and BA
d) Using MATLAB, solve 3.2(A+C) and 3.2A + 3.2C
e) Using MATLAB, determine AB, A-B and A+B

f) Add an identity matrix of same dimension with matrix A with matrix A


g) Multiply magic matrix with matrix C with MATLAB

h) Perform multiplication, division, exponential elementwise operation on matrices A and C

You might also like