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

a. Create a three-dimensional array D whose three layers are these matrices 7-5

ID: 3167950 • Letter: A

Question

a. Create a three-dimensional array D whose three layers are these matrices 7-5 2 A= 6 8-51 B: 7531 C= 10 61 3 -9 8 3 -2 6 9-4 7 9 10 -8 2 b. Use MATLAB to find the largest element in each layer of D and the largest element in D Your Script C Reset MATLAB Documentation 1 %create a three-dimensional array D whose three layers are given matrices 2A= 3B= 5D= 7 % Use MATLAB to find the largest element in each layer of D 10 max-first-layer = 11 max-second-layer = 12 max-layer, third-layer = 13 14 largest-element-in-D = 15 Run Script

Explanation / Answer

% Creating three matrices A , B and C
A=[3 -2 1;6 8 -5;7 9 10]
B=[6 9 -4;7 5 3;-8 2 1]
C=[-7 -5 2;10 6 1;3 -9 8]
%Concatenating A,B and C along the 3rd dimension to create 3D array
D=cat(3,A,B,C);
%Finding largest element in the first layer. max command finds the largest
%element in each column of the matrix. max(max(A)) finds largest element in the whole array
max_first_layer=max(max(D(:,:,1)))
%Finding largest element in the second layer
max_second_layer=max(max(D(:,:,2)))
%Finding largest element in the first layer
max_layer_third_layer=max(max(D(:,:,3)))
%Finding largest element in D.
largest_element_in_D=max(D(:))

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