Create the following matrix 1 2 3 4 5 6 Then create a 3dime
Create the following matrix : (1 2 3; 4 5 6] Then create a 3-dimensional array that has 3 pages, where each page is the above matrix.
Solution
Required code is below (in bold). I have also added comments to explain what is being done
a=1:3; %first row
B=2:4; %second row
A=vertcat(a,b); %create matrix by concatenating a and b vertically
B=A>=3; %1 if value is greater than or equal to 3, 0 otherwise
disp(B); %show B
class(B) %check class of B
C = [1:3;4:6]; %initial 2D array
C(:,:,2)=[1:3;4:6];
C(:,:,3)=[1:3;4:6]; %extend to 3 dimensions with C having 3 pages
![Create the following matrix : (1 2 3; 4 5 6] Then create a 3-dimensional array that has 3 pages, where each page is the above matrix.SolutionRequired code is b Create the following matrix : (1 2 3; 4 5 6] Then create a 3-dimensional array that has 3 pages, where each page is the above matrix.SolutionRequired code is b](/WebImages/15/create-the-following-matrix-1-2-3-4-5-6-then-create-a-3dime-1023619-1761529716-0.webp)