MATLAB Answers

0

Why there is a difference between the dct computed by the MATLAB dct function and one computed by dct matrix multiplication?

Asked by Mohsin Shah on 26 Feb 2018
Latest activity Commented on by Mohsin Shah on 26 Feb 2018
The result is different, though both methods give inverse transform correctly.

  0 Comments

Sign in to comment.

1 Answer

Answer by David Goodmanson on 26 Feb 2018
Edited by David Goodmanson on 26 Feb 2018
 Accepted Answer

Hi Mohsin,
x needs to be a column vector as you did, but you don't need to take the transpose of dctmtx:
x = 1:8
y1 = dct(x')
y2 = dctmtx(8)*x'
y1 - y2
x1 = idct(y1)
x2 = dctmtx(8)\y2
Same results, out and back.

  1 Comment

Sign in to comment.