% simpleRGBimage.m manually specifies intensities in an image I = ones(20,20); % a block of ones, double precision Z = zeros(20,20); % a block of zeros, double precision clear A % clear out A clf subplot(2,2,1) % A consists of 3 matrices A(:,:,1) = [[I Z]; [Z Z]]; % The first tells red intensities A(:,:,2) = [[Z I]; [Z Z]]; % The second tells green A(:,:,3) = [[Z Z]; [I Z]]; % The third tells blue imshow(A); % When A is double, 0<=A<=1 title('Only one color on in each block') subplot(2,2,2) A(:,:,1) = [[I I]; [Z Z]]; % Top of image has red intensity one A(:,:,2) = [[Z I]; [Z I]]; % Right side has green intensity one A(:,:,3) = [[Z Z]; [I I]]; % Bottom has blue intensity one imshow(A); title('Two colors on in the right blocks') subplot(2,2,3) A(:,:,1) = [[I I]; [I Z]]; % All intensities have high values A(:,:,2) = [[Z I]; [I I]]; A(:,:,3) = [[I Z]; [I I]]; imshow(A); title('Two or three colors on in each block') subplot(2,2,4) I = I/2; % Cut intensities in half A(:,:,1) = [[I Z]; [Z Z]]; % The first tells red intensities A(:,:,2) = [[Z I]; [Z Z]]; % The second tells green A(:,:,3) = [[Z Z]; [I Z]]; % The third tells blue imshow(A); title('Image at half intensity')