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

3. Using Matlab a. b. c. d. Create the 7x7 matrix B1, all elements of it shall b

ID: 3751311 • Letter: 3

Question

3. Using Matlab a. b. c. d. Create the 7x7 matrix B1, all elements of it shall be O's. Create the 9x9 matrix B2, all elements of it shall be 3's. Create the 5x5 matrix B3, with 1's at its diagonal and O's for the rest. Create the 4x4 matrix B4, with the values [1 33 7] at its diagonal and O's for the rest. e. f. g. h. Create the row vector B5, with 8 uniformly distributed random numbers. Create the column vector B6, with 5 normally distributed random numbers. Create the 7x5 matrices C1 and C2, by concatenating A3 and B3 in two different ways. Create the 5x2 matrices C3 and C4, by concatenating A2 and B6 in two different ways. 4 Need codes for each part Using Matlab a. Print the second row of B3. b. Print the third column of A3. c. Print rows 1,2 and columns 2,3 of B4. d. Print all rows of A6 except the first. e. Set the last element of A1 to be -42. f. Set the last three elements of A2 to be (13, 47, 91) in a single operation. g. Set rows 2, 3, 4, 5, 6 of B2 to be all 88's. h. Remove the last column of B4 i. Increment each element of the matrix B1 by -2. j. Print the result of the operation C1+C2 k. Print the result of the operation C3 -C4. I. Print the size of matrix C1. m. Print the row count of matrix C1. n. Print the column count of matrx C1 o. Resize the matrix C1 to be 1x35. p. Sort A1 such that it is in ascending order. q. Sort B4 such that its columns are in descending order. r. Print the sum of the columns of B4. s. Print the sum of all elements of B4. t. Print the mean of the rows of B1. u. Print the mean of all elements of B1

Explanation / Answer

Program for Q3.

B1 = zeros(7) % Generating all element zeros
B2 = zeros(9) + 3 % Generating all element zeros and adding three to all element
B3 = zeros(5);

for i = 1:5 % for loop runs from 1 to 5
for j = 1:5 % for loop runs from 1 to 5
if(i == j) % if i and j will be equal means diagonal element
B3(i,j) = 1 % make diagonal element 1
else
B3(i,j) = 0 % making non diagonal element zero
  
end
end
end
B3

B4 = zeros(4);
B4(1,1) = 1 ;
B4(2,2) = 3 ;B4(3,3) = 3 ;B4(4,4) = 7;
B4

for i = 1 : 1
for j = 1: 8
B5(i , j) = rand(); % generating random number
end
end
B5

for i = 1 : 5
for j = 1: 1
B6(i , j) = normrnd(0 , 1); % 0 is the mean and 1 is the deviation
end
end
B6

Answer>

>> yazat

B1 =

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0


B2 =

3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3

B3 =

1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1


B4 =

1 0 0 0
0 3 0 0
0 0 3 0
0 0 0 7


B5 =

0.1712 0.7060 0.0318 0.2769 0.0462 0.0971 0.8235 0.6948


B6 =

-0.7549
1.3703
-1.7115
-0.1022
-0.2414

>> Provide the details of A2 and A3 for full answer

>> Comment are there in answer for explanation

>> contact me for any other help.

>> send values of A matrix , so that i can send you whole code.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote