%% Sphere With Two Colors
% Create a sphere and color it using the pattern from a Hadamard matrix,
% which is a matrix that contains the values |1| and |-1|. Change the
% colors used in the plot by setting the colormap to an array of two RGB triplet
% values.

% Copyright 2015 The MathWorks, Inc.


k = 5;
n = 2^k-1;
[x,y,z] = sphere(n);
c = hadamard(2^k);

figure
surf(x,y,z,c);
colormap([1  1  0; 0  1  1])
axis equal