Orthogonality of a 4x4 DCT matrix

17 views (last 30 days)
Anonym
Anonym on 7 Dec 2020
Commented: Bjorn Gustavsson on 26 Sep 2022
I am working on a MATLAB task which deals with stain removal and Discrete Cosine tranformation.
What am I doing? I have been given a 4x4 matrix. I have then been told that it may well be orthogonal. I have to make it prove that the DCT matrix is actually orthogonal.
This is the given DCT matrix:
0.5000 0.5000 0.5000 0.5000
0.6533 0.2706 -0.2706 -0.6533
0.5000 -0.5000 -0.5000 0.5000
0.2706 -0.6533 0.6533 -0.2706
Here's the code:
function [U, C, G] = UFGDCT(N)
%
% Compute the matrices for DCT (-?-)
%
% U is the unitary "in-between" matrix
% C is the matrix of the DCT
% G is the inverse of F
%
C = zeros(N);
for row = 0:N-1
for col = 0:N-1
C(row+1, col+1) = cos(pi*row*(col+(1/2))/N);
end
end
for cols = 0:N-1
C(1,cols+1) = C(1,cols+1)/sqrt(2);
end
C = C*sqrt(2/N);
U = C;
G = C';
end
How can I do it in the simplest way? I have tried to search about finding orthogonality of a matrix, but didn't get the luch. I could not find anything that could be helpful.

Answers (2)

Bjorn Gustavsson
Bjorn Gustavsson on 8 Dec 2020
What does it mean that a matrix is orthogonal?
What is the condition for two vectors to be orthogonal?
Answer these two questions and the easiest method will become obvious to you.
HTH

Farooq
Farooq on 24 Sep 2022
Orthogonality of a matrix means that the matrix multiplied by its inverse is equal to the identity matrix.
matrix * matrix ' = I
In MATLAB you can code this for example for a matrix "x"
if x*x' == eye(size(x))
y = true
else
y = false
end
I hope this helps.
  1 Comment
Bjorn Gustavsson
Bjorn Gustavsson on 26 Sep 2022
Well, your code is OK but it doesn't correspond to your phrasing, and your phrasing is a bit "too generous" - every matrix multiplied by its inverse should result in the identity-matrix, surely?

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!