I need to model the relationship between the DCT and DFT transforms (If it exists). I mean real signal $x \to y = \textrm{DCT}(x) \to z = \textrm{DFT}(y)$, so I need to get the relationship between the $x$ and $z$ if possible.

For more details:

Assume I have a real signal $x[m],\ m=1,2,….N$, the $N$-point IDCT transform of the signal $x[m]$ is $X[n]$ which can be written as follows (let's ignore the coefficients for simplicity):

$$X[n] = \sum_{m=1}^N x[m] \cos\left( \frac{(2m+1)n\pi}{2N} \right)$$

I need to get the relationship between the FFT of $X[n]\ $ and the signal $x[m]$, so taking the $2N-$point DFT for the signal $X[n]\ $ (I upsampled the signal to have the DFT of each point resulted from the IDCT), that will give:

$$Y[v] = \sum_{n=1}^{2N} X[n] e^{-\frac{j2\pi mn}{2N}} = \sum_{n=1}^{2N} \left[ \sum_{m=1}^N x[m] \cos\left( \frac{(2m+1)n\pi}{2N} \right) \right] e^{-\frac{j2\pi mv}{2N}}$$

with some mathematical operations, we can get:

$$Y[v] = \sum_{n=1}^{2N} \left( \left[ \sum_{m=1}^N x[m] \cos\left( \frac{(2m+1)n\pi}{2N} \right) \right] \cos\left(\frac{2\pi mv}{2N}\right) - j\left[\sum_{m=1}^N x[m] \cos\left( \frac{(2m+1)n\pi}{2N} \right) \right] \sin\left(\frac{2\pi mv}{2N}\right) \right)$$

I am trying to get the relationship between the $Y[v]$ and $x[m]$ from the relationship above if it exists. How can we get it?

  • 2
    $\begingroup$ Try to derive it in terms of matrices $\endgroup$
    – I.M.
    May 23 at 0:18
  • 1
    $\begingroup$ I have transformed your equations into latex. Please check if there is an error. I noticed that in your two last equations, your first sum must use $n$ index. $\endgroup$
    – AlexTP
    May 23 at 8:22
  • $\begingroup$ @AlexTP, Yes, they are right now. Thank you for correcting it. $\endgroup$
    – Fatima_Ali
    May 23 at 8:24
  • 1
    $\begingroup$ Hint for your question: DCT is a DFT of signals with some symmetry characteristics. For the general case, the matrix forms will help. $\endgroup$
    – AlexTP
    May 23 at 8:27
  • $\begingroup$ @AlexTP I am trying to formulate it in terms of matrices, but I also couldn't get a logic expression for that. $\endgroup$
    – Fatima_Ali
    May 23 at 8:29

You have some confusion in the indices, maybe the correct expression would be

$$Y[k] = \sum_{n=1}^N \left[ \sum_{m=1}^N x[m] \cos\left( \frac{(2m+1)n\pi}{2N} \right) \right] e^{-\frac{j2\pi k n}{N}}$$

The DCT is the real part of the odd-indices coefficients of double length DFT

Expressing DCT in terms of complex harmonics

$$z[n] = \sum_{m=1}^N x[m] \left( \exp\left( j \frac{(2m+1)n\pi}{2N} \right) + \exp\left( -j \frac{(2m+1)n\pi}{2N} \right) \right)$$

If you take $X(n)$ being the fourier transform of $x$, in the reals instead of the integers, you could write $z[n] = X(m+1/2)+X(-m-1/2)$, $X(n)$ has Hermitian symmetry and the result agrees with the fact that $z[n]$ is real.

I think that the most efficient way to express the relation between $Y[m]$ and $x[m]$, is that $Y = DFT(DCT(x))$, unless you want to upsample your signal.

The denominator $2N$ in the exponential, the summation is from $1$ up to $N$, and the numerators may be even, so cannot simplify the exponent, the way to go is to compute a $2N$-samples, DFT.

If you create an intermediate signal with odd samples $v_{2i+1} = x_i + x_{N - i}$ and even samples $v_{2i}=0$, and compute $V = DFT^{-1}(v)$, then the first $N$ elements of $V$ equals to $z$, and the $DFT(V) = DFT(DFT^{-1}(v)) = v$

  • $\begingroup$ What's about if we upsampled the signal, it means we take DFT with $2N$ points, right? in that case, can we get a relationship between $z[n]$ and $x[m]$? $\endgroup$
    – Fatima_Ali
    May 23 at 14:01
  • $\begingroup$ You are right, I must up-sample the signal, and what I wanted to put in the question is to get the DFT with $2N-$point DFT. But, even in that case, I am not sure if I can get the relationship between $z[n]$ and $x[m]$. Additionally, $x[m]$ is always a real signal $\endgroup$
    – Fatima_Ali
    May 23 at 14:09
  • $\begingroup$ I tried also to add that notice into the question. . $\endgroup$
    – Fatima_Ali
    May 23 at 14:21
  • 1
    $\begingroup$ $z_{i}=V_{i}$ for $i \le N$ and since $v$ is real $V$ has Hermitian symmetry, i.e. $V_i = conj(V_{2N-i})$ $\endgroup$
    – Bob
    May 23 at 19:46
  • $\begingroup$ Could you please add it into your answer with more details. I couldn't get what you mean. I am really very interested in understanding your answer. $\endgroup$
    – Fatima_Ali
    May 23 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.