5

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?

Fatima_Ali
  • 598
  • 2
  • 12
  • 2
    Try to derive it in terms of matrices – I.M. May 23 '21 at 00:18
  • 1
    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. – AlexTP May 23 '21 at 08:22
  • @AlexTP, Yes, they are right now. Thank you for correcting it. – Fatima_Ali May 23 '21 at 08:24
  • 1
    Hint for your question: DCT is a DFT of signals with some symmetry characteristics. For the general case, the matrix forms will help. – AlexTP May 23 '21 at 08:27
  • @AlexTP I am trying to formulate it in terms of matrices, but I also couldn't get a logic expression for that. – Fatima_Ali May 23 '21 at 08:29
  • @AlexTP I think that cannot be explained in forms of matrices since what I need is, first, $N-$point DCT for $x[m]$ where $m = 1,2,....N$, and then same size of DFT which is $(N-point DFT)$. – Fatima_Ali May 23 '21 at 09:50
  • I see it simply as $y=Cx$ and $z=Fy$ therefore $z=FCx$. Also, your edited last equation does not contain $\nu$ on the right-hand side. – AlexTP May 23 '21 at 15:27

1 Answers1

3

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$

Bob
  • 2,348
  • 4
  • 11
  • 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]$? – Fatima_Ali May 23 '21 at 14:01
  • 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 – Fatima_Ali May 23 '21 at 14:09
  • I tried also to add that notice into the question. . – Fatima_Ali May 23 '21 at 14:21
  • 1
    $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})$ – Bob May 23 '21 at 19:46
  • 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. – Fatima_Ali May 23 '21 at 22:55
  • In the last paragraph, dor you mean $DFT(DCT^{-1}(v)) = v$, is that right? also $v_{2i+1} = x_i + jx_{N-i}$ where $j = \sqrt{-1}$, right ? .. but in that way the vector $v$ becomes a complex vector instead of $x$ real data. – Fatima_Ali May 24 '21 at 14:34
  • No I really mean what is written, it comes from the expansion of the cosine in terms of complex exponentials – Bob May 24 '21 at 14:59
  • so, where is the relationship here between the DCT and DFT ? .. – Fatima_Ali May 24 '21 at 15:22
  • There are many ways to relate them, you can check more alternatives here – Bob May 24 '21 at 17:18
  • Thank you, that might help in understanding the relationship between DFT and DCT. However, that is not what I am asking about – Fatima_Ali May 26 '21 at 04:20