Matrix Operations and Manipulation, Summaries of Engineering

A step-by-step guide on how to create various matrices and vectors, and then manipulate them to form a new matrix. The creation of a 2x3 matrix m1 with all entries as ones, a 3x1 vector v1 with all entries as ones, a 3x3 matrix m2 with diagonal entries as fives, and then the creation of a new matrix m3 using m1, m2, and v1. Additionally, the document demonstrates how to create three new vectors v2, v3, and v4 by referencing the rows of m3, and then altering specific entries in these vectors to create a new matrix m4. This document could be useful for students studying linear algebra, matrix theory, or numerical methods, as it provides hands-on examples of common matrix operations and manipulations.

Typology: Summaries

2023/2024

Uploaded on 03/31/2024

daniyal-shabbir
daniyal-shabbir 🇵🇰

4 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
(a) Make a matrix M1 which consists of two rows and three columns and all the entries in the
matrix are ones.
(b) Make a vector V1 consisting of three ones.
(c) Make a 3x3 matrix M2 in which the diagonal entries are all fives.
(d) Now make a matrix M3 from M1, M2 and V1 which look like the matrix given below
M3=
1 1 1
1 1 1
0 0 0
5 0 0
0 5 0
0 0 5
Creating matrix M1
M1 = ones(2, 3);
% Creating vector V1
V1 = ones(3, 1);
% Creating matrix M2 with diagonal entries as fives
M2 = 5 * eye(3);
% Creating matrix M3 using M1, M2, and V1
M3 = [M1; M2(1:2, ; zeros(1, 3)];
% Displaying the result
Disp(‘Matrix M3:’);
Disp(M3);
(e) Now use the referencing element concept to make three vectors V2, V3 and V4 such that V2
consists of first row of M3, V3 consists of second row of M3 and V4 consists of third row of M3.
(f) Now alter the fourth entry of vectors V2, fifth entry of V3 and sixth entry of V4 to 1.4 and
make a new vector M4 which looks like the matrix given below.
M4=
1 1 1
1 1 1
0 0 0
1.4 0 0
0 1.4 0
0 0 1.4

Partial preview of the text

Download Matrix Operations and Manipulation and more Summaries Engineering in PDF only on Docsity!

(a) Make a matrix M1 which consists of two rows and three columns and all the entries in the matrix are ones. (b) Make a vector V1 consisting of three ones. (c) Make a 3x3 matrix M2 in which the diagonal entries are all fives. (d) Now make a matrix M3 from M1, M2 and V1 which look like the matrix given below M3=

Creating matrix M M1 = ones(2, 3); % Creating vector V V1 = ones(3, 1); % Creating matrix M2 with diagonal entries as fives M2 = 5 * eye(3); % Creating matrix M3 using M1, M2, and V M3 = [M1; M2(1:2, ; zeros(1, 3)]; % Displaying the result Disp(‘Matrix M3:’); Disp(M3); (e) Now use the referencing element concept to make three vectors V2, V3 and V4 such that V consists of first row of M3, V3 consists of second row of M3 and V4 consists of third row of M3. (f) Now alter the fourth entry of vectors V2, fifth entry of V3 and sixth entry of V4 to 1.4 and make a new vector M4 which looks like the matrix given below. M4=