Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Matlab Question) Create the following matrices, and use them in the exercises t

ID: 3818968 • Letter: #

Question

(Matlab Question)

Create the following matrices, and use them in the exercises that follow:

a=[15 3 22; 3 8 3; 22 5 82] b= [1;5;6] c=[12 18 5 2]

(a) Create a matrix called d from the third column of matrix a.
(b) Combine matrix b and matrix d to create 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 rst three elements of matrix c,

with four rows and three columns.
(e) Create a matrix h with the rst element equal to a1,3, the second ele-

ment equal to c1,2, and the third element equal to b2,1.

Explanation / Answer

a = [15 3 22; 3 8 3; 22 5 82];    %3 * 3 Matrix
b = [1;5;6] ; % 3 * 1 Matrix
c = [12 18 5 2] ; % 1*1 Matrix

% Qus 1
d = a(:,3)

% Qus 2
e = cat(2,b,d)

%Qus 3
f = vertcat(b,d)

%Qus 4
g = vertcat(a,c(1:3))

%Qus 5
h = [a(1,3) c(1,2) b(2,1)]