%% Display Matrix Elements as Scaled Colors
% Display matrix elements of several test matrices as scaled colors.
% Create a circulant matrix of size 11-by-11. A circulant matrix is a special kind of Toeplitz matrix where each row is obtained from the previous one by cyclically moving the entries one place to the right.

C = gallery('circul',11);

%  Display an image of the matrix elements in C. Add a colorbar to the graph to show the current colormap.

imagesc(C)
axis square
colorbar

% Create a grcar matrix of size 11-by-11. A grcar matrix is a nonsymmetric Toeplitz matrix with -1's on the subdiagonal, 1's on the main diagonal, and 1's on the first few diagonals above the main diagonal.

G = gallery('grcar',11);

%  Display an image of the matrix elements in G.

imagesc(G)
axis square
colorbar

% Create a minij matrix of size 11-by-11. A minij matrix M is a symmetric positive definite matrix with elements M(i,j) = min(i,j).

M = gallery('minij',11);

%  Display an image of the matrix elements in M.

imagesc(M)
axis square
colorbar

%
% Copyright 2019 The MathWorks, Inc.