• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

MatLab 3-Dimensional Array Question

SilentButDeadly

Senior member
11.* a. Create a three-dimensional array D whose 3 "layers" are these matrices:

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]

b. Use MATLAB to find the largest element in each layer of D and the largest element in D.


a. I got D=cat(3,A,B,C)

b. I am stuck on this part... Only thing I can think of is a=max(D🙂,:,1)); b=max(D🙂,:,2)); c=max(D🙂,:,3));

Then I do max(D) to try and find the largest element in D.

Nothing is working right on this problem for me, and I have been trying everything I know. Anyone have a solution for Part B?
 
Just in case anyone was curious, a guy sitting right behind me in the library knew the answer xD. Anyways I had to take the max twice, so it would basically be:

a=max(max(D🙂,:,1))); b=max(max(D🙂,:,2))); c=max(max(D🙂,:,3)));

or you could just do:

d=max(max(D)); (This will give you all the 3 answers above).

After you do this, to take the largest element in D all you have to do is:

maxD=max(max(max(D)));

Seems as though this was really simple. I just got a brain cramp or something I guess 😛
 
Back
Top