Q:

Write a script that will create the image seen in the Figure below using a colormap

0

Figure Image displaying four colors using a custom colormap 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Ch13Ex2.m

% Creates a four color image using a custom colormap

mycolormap = [1 0 0; 0 1 0; 0 0 1; 1 1 1];

colormap(mycolormap)

mat = ones(50);

mat(1:25,1:25) = 4;

mat(1:25, 26:50) = 2;

mat(26:50, 26:50) = 3;

image(mat)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now