Write a script that will show shades of green and blue. First, create a colormap that has 30 colors (ten blue, ten aqua, and then ten green). There is no red in any of the colors. The first ten rows of the colormap have no green, and the blue component iterates from 0.1 to 1 in steps of 0.1. In the second ten rows, both the green and blue components iterate from 0.1 to 1 in steps of 0.1. In the last ten rows, there is no blue, but the green component iterates from 0.1 to 1 in steps of 0.1. Then, display all of the colors from this colormap in a 3 x 10 image matrix in which the blues are in the first row, aquas in the second, and greens in the third, as follows (the axes are the defaults). Do not use loops.
Ch13Ex7.m
colors = zeros(30,3);
vec = repmat(0.1:.1:1,1,2)'
colors(11:end,2) = vec;
colors(1:20,3) = vec;
colormap(colors)
mat = reshape(1:30,10,3)';
image(mat)
need an explanation for this answer? contact us directly to get an explanation for this answer