Orthogonality of a 4x4 DCT matrix
6 次查看(过去 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 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!