0
$\begingroup$

I have applied a DCT (type 2) to a vector of values acquired from a sensor, of length $N = 8$. I received a vector of DCT coefficients. How can I find out the frequency of each bin in Hz? The sampling frequency of initial values is 10000 Hz.

$\endgroup$
10
  • 1
    $\begingroup$ It's right there in the formula, could you elaborate what the question is? $\endgroup$ Nov 19, 2021 at 9:38
  • $\begingroup$ as example, we have vector of values x = [16, 11, 10, 16, 24, 40, 51, 61]. after applying dct we receive vector of values X = [80.9637 -47.811 19.3879 2.1278 1.76777 0.863142 1.53637 -1.82703]. so what frequency does the value 80.9637 or -47.811 represent? what is the formula to find out the frequency for each coefficient $\endgroup$
    – Azazel
    Nov 19, 2021 at 12:49
  • $\begingroup$ look at the formula of the DCT-II, not at the numbers. Do you know how to read the frequency from the argument of the cosine? $\endgroup$ Nov 19, 2021 at 12:50
  • $\begingroup$ in DCT-II formula we have cos ( pi / N * (n + 1/2) * k ). N = length of dct, k = bin number. but we also have n, because this cosine is taken from summ. what should i do with this n? i cant calculate this. as for reading frequency from the argument, i know that frequency of A * cos (Bx - C) + D is B / 2pi. i don't understand how to deal with this all, can you write the correct formula please? is this something like (pi / N * k) / 2pi ? $\endgroup$
    – Azazel
    Nov 19, 2021 at 14:34
  • $\begingroup$ I know that frequency of A · cos (Bx - C) + D is B / 2pi. Exactly! Now you realize n is your variable (instead of x), so you equate $Bn - C = \pi/N (n+\frac12)k$, and solve for $B$. $\endgroup$ Nov 19, 2021 at 15:06

1 Answer 1

2
$\begingroup$

i know that frequency of A * cos (Bx - C) + D is B / 2pi

Exactly. So let's take the DCT-II:

$$X[k]:=\sum_{n=0}^{N-1} x_n \cos \left[\, \tfrac{\,\pi\,}{N} \left( n + \frac{1}{2} \right) k \, \right] \qquad \text{ for } ~ k = 0,\ \dots\ N-1$$

and look at the argument of the cosine.

\begin{align} \frac\pi N\left( n+\frac12 \right) k &= \underbrace{\pi \frac kNn}_{Bn} + \underbrace{\pi\frac k{2N}}_{-C}\\[1em] B&=\pi\frac kN \end{align}

Therefore, the frequency is $\frac k{2N}$, which should align nicely with any explanation of how to construct the bases: you take the Nyquist rate and divide it into $N$ even parts.

Now, this is frequency relative to your sampling rate, so all you need to do is realize (see comments):

with that frequency you can calculate the period in samples! And if you know how long a period is in samples, and you know the sampling rate, you know how long the period is in seconds. and if you know how long a period is in seconds, then you know the frequency in Hertz.

So, this is really just the fraction of your sampling rate. Note that relative frequencies are really the basics of any discrete signal theory introduction, which means you might benefit from revisiting an introductory book on discrete-time signal processing (e.g. the Oppenheim book of the same title) in its first chapters.

$\endgroup$
2
  • $\begingroup$ Thank you very much, it was helpful $\endgroup$
    – Azazel
    Nov 20, 2021 at 14:02
  • 1
    $\begingroup$ @Azazel hey, coming back to this: if this was helpful, why not accept the answer? That way, this question stops being marked as "in need of an answer" on our website. $\endgroup$ Aug 17, 2022 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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