Orthogonality of a 4x4 DCT matrix
조회 수: 9 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (2개)
Bjorn Gustavsson
2020년 12월 8일
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
댓글 수: 0
Farooq
2022년 9월 24일
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
Bjorn Gustavsson
2022년 9월 26일
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?
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!