You are on page 1of 5

Islamic University ‫الجامعة اإلسالمية‬

Faculty of Engineering
Department of Electrical
‫كلية الهندسة‬
Engineering ‫قسم الهندسة الكهربائية‬

ENGR 3032

SCIENTIFIC COMPUTING LANGUAGES


Term 443 2023

LAB 3

Problem Solving using scientific computing languages:


Matrix manipulation
[CO 3; PI_1_2; SO 1]

Submitted To
Dr. Abdulmajeed Alenezi

Submitted By
Sultan Momar Alshalabi
422039543

Section No: 2068

ENGR 3032, Term 443 2023


Task 1
Q1. Create the following matrices, and use them in the exercises that follow:

51 23 12
a= [30 18 15]
44 63 92

b= [11 8 2]

c= [72 38 55 82]

a. Create a vector called d from the second column of matrix a


b. Combine matrix b and matrix d into a new matrix e, a two-dimensional matrix with three rows
and two columns.
c. Combine matrix b and matrix d to create matrix f, a one-dimensional matrix with six rows and
one column.
d. Create a matrix g from matrix a and the first three elements of matrix c, with four rows and three
columns.
e. Create a new matrix h with the first element equal to a 1, 3 , the second element equals c1, 2 and
the third element equal to b 1, 2

Answer:

ENGR 3032, Term 443 2023


Task 2

Using meshgrid function:


1. The area of a rectangle is its length times width (area = length * width). Find the areas of
rectangles with lengths of 11, 30, and 15 cm and with widths of 8, 9, 10, and 12 cm. (You
should have 12 answers.)
2. The volume of a circular cylinder is, volume = πr2 h. Find the volume of cylindrical
containers with radii from 0 to 14 m and heights from 5 to 15 m. Increment the radius
dimension by 5 m and the height by 2 m as you span the two ranges.

Answer:

Task 3
1. Create a 4 × 6 matrix in which all the elements have a value of pi.
2. Create a 6 × 6 magic matrix.
a) What is the sum of each of the rows?
b) What is the sum of each of the columns?
c) What is the sum of each of the diagonals?
3. Create a 10 × 10 magic matrix.
a) Extract the diagonal from this matrix.
b) Extract the diagonal that runs from lower left to upper right from this matrix.
c) Confirm that the sums of the rows, columns, and diagonals are all the same.

ENGR 3032, Term 443 2023


Answer:

Task 4
1. Using the xlsread function perform the following operations:
a. Extract the scores and the student ID for the 7 th student into a row vector named student_5 .
b. Extract the scores for the Lab Experiment into a column vector named Lab.
c. Find the standard deviation and variance for the total score and for the lab experiment.

ENGR 3032, Term 443 2023


Answer:

ENGR 3032, Term 443 2023

You might also like