This is a practice for a classwork.
In this approach the colors in the image are determined by a colormap. The values stored in the image matrix are scaled, and the values are correlated with a known map.
This approach works well when the parameter being displayed does not correlate with an actual color.
map = colormap;
[r c] = size(map)
cmap = reshape(1:r, 8 ,8)
image(cmap)
Write a script that will generate a 50 X 50 image of pixels. The lower triangular part (including the diagonal) will be all yellow.
The upper triangular part will be randomly either red or green for each element.