Q:

Write a script that will create a colormap that just has two colors: white and black. The script will then create a 50x50 image matrix in which each element is randomly either w

0

 1/Write a script that will create a colormap that just has two colors: white and black. The script will then create a 50x50 image matrix in which each element is randomly either white or black. In one Figure Window, display this image on the left. On the right, display another image matrix in which the colors have been reversed (all white pixels become black and vice versa). For example, the images might look like this (the axes are defaults; note the titles):

Do not use any loops or if statements. 

2/ For the image matrix that you created, what would you expect the overall mean of the matrix elements to be?

All Answers

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

Answer 1/

Ch13Ex6.m

bwmap = [0 0 0; 1 1 1];

colormap(bwmap)

mat = randi(2,50);

subplot(1,2,1)

image(mat)

title('Yin')

subplot(1,2,2)

yang = ~(mat - 1);

image(yang)

title('Yang')


Answer 2/

1.5

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