
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

(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=