% Script: ShowDCTBasis
% This is about a basis for the vector space of all 8x8 matrices.
clc
close all
% The 8x8 DCT matrix and its inverse...
C8 = cos((pi/16)*((0:7)'*(1:2:15)));
IC8 = C8'; IC8(:,1) = IC8(:,1)/8;IC8(:,2:8) = IC8(:,2:8)/4;
% Let v{1},...,v{8} be the columns of IC8...
for k=1:8
v{k} = IC8(:,k);
end
% These vectors can be used to define 64 rank-1 matrices, e.g., Xij = v{i}v{j}'.
% Any 8x8 matrix can be expressed as a linear combination of the Xij.
% That is, the Xij are a basis for the vector space of 8x8 matrices.
% Let's take a look at them...
colormap(linspace(0,1,255)'*[1 1 1])
for i=1:8
for j=1:8
Xij = v{i}*v{j}';
Xij = Xij/max(max(abs(Xij))); % this dramatizes the color-coded display
pcolor(Xij)
title(sprintf('v{%1d}*v{%1d}''',i,j),'fontsize',18)
axis equal off
shg
pause
end
end