To create:
The
Answer to Problem 13.2P
Solution:
The script file is,
matrix = zeros(2, 2, 3);
%define the 3*3 true color matrix.
matrix(1, 1, 3) = 255;
matrix(1, 3, 3) = 255;
matrix(1, 2, 3) = 255;
matrix(2, 1, 3) = 255;
matrix(3, 3, 3) = 255;
matrix(2, 2, 3) = 255;
matrix(2, 2, 3) = 255;
matrix(3, 1, 3) = 255;
matrix(3, 2, 3) = 255;
matrix(2, 3, 1) = 255;
matrix = uint8(matrix);
image(matrix);
%create an image of a 3*3 true color matrix.
Explanation of Solution
A true color matrix is created of the order of
MATLAB Code:
matrix = zeros(2, 2, 3);
%define the 3*3 true color matrix.
matrix(1, 1, 3) = 255;
matrix(1, 3, 3) = 255;
matrix(1, 2, 3) = 255;
matrix(2, 1, 3) = 255;
matrix(3, 3, 3) = 255;
matrix(2, 2, 3) = 255;
matrix(2, 2, 3) = 255;
matrix(3, 1, 3) = 255;
matrix(3, 2, 3) = 255;
matrix(2, 3, 1) = 255;
matrix = uint8(matrix);
image(matrix);
%create an image of a 3*3 true color matrix.
Save the MATLAB files with name, chapter13_54793_13_2P.m in the current folder. Execute the file by typing the name at the command window to generate output.
Result:
The figure window is,
Therefore, the result is stated above.
Want to see more full solutions like this?
Chapter 13 Solutions
MATLAB: A Practical Introduction to Programming and Problem Solving
- Linear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage LearningAlgebra for College StudentsAlgebraISBN:9781285195780Author:Jerome E. Kaufmann, Karen L. SchwittersPublisher:Cengage LearningElementary Linear Algebra (MindTap Course List)AlgebraISBN:9781305658004Author:Ron LarsonPublisher:Cengage Learning
- College Algebra (MindTap Course List)AlgebraISBN:9781305652231Author:R. David Gustafson, Jeff HughesPublisher:Cengage Learning