0% found this document useful (0 votes)
3 views

DCT_Bases_Normalized

The document outlines the process of creating 1D and 2D orthogonal bases using the Discrete Cosine Transform (DCT) for a matrix of size N=4. It includes steps for generating normalized DCT vectors, verifying orthogonality, and constructing 2D bases from the 1D bases, ultimately demonstrating the orthonormality of the resulting vectors. The document also presents MATLAB code snippets for implementing these concepts.

Uploaded by

Calmer Music
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

DCT_Bases_Normalized

The document outlines the process of creating 1D and 2D orthogonal bases using the Discrete Cosine Transform (DCT) for a matrix of size N=4. It includes steps for generating normalized DCT vectors, verifying orthogonality, and constructing 2D bases from the 1D bases, ultimately demonstrating the orthonormality of the resulting vectors. The document also presents MATLAB code snippets for implementing these concepts.

Uploaded by

Calmer Music
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Creating 1D and 2D Orthogonal Bases

Discrete Cosine Transform

N=4
Sampling Locations

For Generic N, Sampling Locations

k= 0,2,...N-1

1
Functions Sampled : Multiples of half waves

% creating Normalized DCT Vectors in columns


% We are sampling orthogonal cosine functions
% They are multiples of Half waves
N = 4;
n = 0:N-1; % Row vector
t = n*pi/N + pi/(2*N); % Theta vector: Row vector
t=t(:); % Make it a column vector
B = cos(t*n) % Outer Product

B = 4×4
1.0000 0.9239 0.7071 0.3827
1.0000 0.3827 -0.7071 -0.9239
1.0000 -0.3827 -0.7071 0.9239
1.0000 -0.9239 0.7071 -0.3827

% A tricky step
B = B./sqrt(sum(B.^2))

B = 4×4
0.5000 0.6533 0.5000 0.2706
0.5000 0.2706 -0.5000 -0.6533
0.5000 -0.2706 -0.5000 0.6533
0.5000 -0.6533 0.5000 -0.2706

% Matlab Built in Bases as columns


B1=idct(eye(N))

2
ans = 4×4
0.5000 0.6533 0.5000 0.2706
0.5000 0.2706 -0.5000 -0.6533
0.5000 -0.2706 -0.5000 0.6533
0.5000 -0.6533 0.5000 -0.2706

% Verify orthogonality
disp(num2str(a'*c,'%0.2f'))
disp(num2str(a'*c,'%0.2f'))

Creating 2D Orthogonal Bases

4x4 Matrix - 16 elements

There are 16 2D Bases

Vectorise each base and store in a column vector.

Show that all 16 tuple vectors are orthonormal

B1=idct(eye(4));
clear DB;
k1=0;
for i= 1:4
for j=1:4
b1=B1(:,i); b2=B1(:,j);
C=b1*b2';
disp(k1+1);
disp(num2str(C,'%0.2f'))
disp('----------------------------------')
k1=k1+1;
DB(k1,:)=C(:);
clear C;
end
end

3
1
0.250.250.250.25
0.250.250.250.25
0.250.250.250.25
0.250.250.250.25
----------------------------------
2
0.33 0.14-0.14-0.33
0.33 0.14-0.14-0.33
0.33 0.14-0.14-0.33
0.33 0.14-0.14-0.33
----------------------------------
3
0.25-0.25-0.25 0.25
0.25-0.25-0.25 0.25
0.25-0.25-0.25 0.25
0.25-0.25-0.25 0.25
----------------------------------
4
0.14-0.33 0.33-0.14
0.14-0.33 0.33-0.14
0.14-0.33 0.33-0.14
0.14-0.33 0.33-0.14
----------------------------------
5
0.33 0.33 0.33 0.33
0.14 0.14 0.14 0.14
-0.14-0.14-0.14-0.14
-0.33-0.33-0.33-0.33
----------------------------------
6
0.43 0.18-0.18-0.43
0.18 0.07-0.07-0.18
-0.18-0.07 0.07 0.18
-0.43-0.18 0.18 0.43
----------------------------------
7
0.33-0.33-0.33 0.33
0.14-0.14-0.14 0.14
-0.14 0.14 0.14-0.14
-0.33 0.33 0.33-0.33
----------------------------------
8
0.18-0.43 0.43-0.18
0.07-0.18 0.18-0.07

4
-0.07 0.18-0.18 0.07
-0.18 0.43-0.43 0.18
----------------------------------
9
0.25 0.25 0.25 0.25
-0.25-0.25-0.25-0.25
-0.25-0.25-0.25-0.25
0.25 0.25 0.25 0.25
----------------------------------
10
0.33 0.14-0.14-0.33
-0.33-0.14 0.14 0.33
-0.33-0.14 0.14 0.33
0.33 0.14-0.14-0.33
----------------------------------
11
0.25-0.25-0.25 0.25
-0.25 0.25 0.25-0.25
-0.25 0.25 0.25-0.25
0.25-0.25-0.25 0.25
----------------------------------
12
0.14-0.33 0.33-0.14
-0.14 0.33-0.33 0.14
-0.14 0.33-0.33 0.14
0.14-0.33 0.33-0.14
----------------------------------
13
0.14 0.14 0.14 0.14
-0.33-0.33-0.33-0.33
0.33 0.33 0.33 0.33
-0.14-0.14-0.14-0.14
----------------------------------
14
0.18 0.07-0.07-0.18
-0.43-0.18 0.18 0.43
0.43 0.18-0.18-0.43
-0.18-0.07 0.07 0.18
----------------------------------
15
0.14-0.14-0.14 0.14
-0.33 0.33 0.33-0.33
0.33-0.33-0.33 0.33
-0.14 0.14 0.14-0.14
----------------------------------
16

5
0.07-0.18 0.18-0.07
-0.18 0.43-0.43 0.18
0.18-0.43 0.43-0.18
-0.07 0.18-0.18 0.07
----------------------------------

size(DB);
disp(num2str(abs(DB'*DB),'%0.0f'))

1000000000000000
0100000000000000
0010000000000000
0001000000000000
0000100000000000
0000010000000000
0000001000000000
0000000100000000
0000000010000000
0000000001000000
0000000000100000
0000000000010000
0000000000001000
0000000000000100
0000000000000010
0000000000000001

You might also like