Q:

Create a three-dimensional matrix with dimensions 2 x 4 x 3 in which the first “layer” is all 0s, the second is all 1s and the third is all 5s. Use size to verify the dimensions

0

 Create a three-dimensional matrix with dimensions 2 x 4 x 3 in which the first “layer” is all 0s, the second is all 1s and the third is all 5s. Use size to verify the dimensions.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

>> mat3d = zeros(2,4,3);

>> mat3d(:,:,2) = 1;

>> mat3d(:,:,3) = 5;

>> mat3d

mat3d(:,:,1) =

 0 0 0 0

 0 0 0 0

mat3d(:,:,2) =

 1 1 1 1

 1 1 1 1

mat3d(:,:,3) =

 5 5 5 5

 5 5 5 5

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now