clear all
close all

%create a 2 x 2 image with RGB and white values
col = zeros(2,2,3);
% element 1x1 is red
col(1,1,1) = 255;
%element 1x2 is green
col(1,2,2) = 255;
%element 2x1 is blue
col(2,1,3) = 255;
%element 2x2 is white
col(2,2,1:3) = 255;
%convert to smallest size uint
coli = uint8(col);
figure(5)
image(coli)

%define nc as the number of elements in a colormap
nc = 100;
% define nc red, green, and blue values between 0-1
r = linspace(0,1,nc);
g = linspace(0,1,nc);
b = linspace(0,1,nc);
% define row vector of zeros
n = zeros(1,nc);

% create a row vector with nc elements
I = 1:nc;

figure(1)
%create grey colormap
map_grey = [r', g', b'];
%imagesc displays the colormap
imagesc(I)
colormap(map_grey)
%create a red colormap
map_red = [r',n',n'];
figure(2)
imagesc(I)
colormap(map_red)

%see how the jet color map is defined
figure(3)
imagesc(I)
cmap = colormap('jet');
%how many values are in the jet colormap?

%make a yellow color map!
%make a cyan color map!