%% IDCT transform
% Tom Wada
% 2011/6/27

N=8;
n=(0:N-1)';
%基底関数
q=zeros(N,N);
q(:,1)=1*cos(pi/(2*N)*(2*n+1)*0);
for l=2:N
    q(:,l)=sqrt(2)*cos(pi/(2*N)*(2*n+1)*(l-1));
end

%% 基底関数
p
%%入力
AA=[1 2 3 4 5 6 7 8]'
%% 教科書のDCT
textidct=q*AA
%%　MATLAB DCT
matidct=idct(AA)
%% MATLAB　DCTを自分の基底関数で再現
handmatidct=q*AA/sqrt(8)

