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
- MATLAB: An Introduction with ApplicationsStatisticsISBN:9781119256830Author:Amos GilatPublisher:John Wiley & Sons IncProbability and Statistics for Engineering and th...StatisticsISBN:9781305251809Author:Jay L. DevorePublisher:Cengage LearningStatistics for The Behavioral Sciences (MindTap C...StatisticsISBN:9781305504912Author:Frederick J Gravetter, Larry B. WallnauPublisher:Cengage Learning
- Elementary Statistics: Picturing the World (7th E...StatisticsISBN:9780134683416Author:Ron Larson, Betsy FarberPublisher:PEARSONThe Basic Practice of StatisticsStatisticsISBN:9781319042578Author:David S. Moore, William I. Notz, Michael A. FlignerPublisher:W. H. FreemanIntroduction to the Practice of StatisticsStatisticsISBN:9781319013387Author:David S. Moore, George P. McCabe, Bruce A. CraigPublisher:W. H. Freeman