1
$\begingroup$

I need your help. My lecturer told me to do a study to finish the task that she gave us yesterday but the thing is there is no specific explaination on how to solve the question. Through the task, she gave us only this information. I went through youtubes in case there'll be explaination on those but so far i didnt find anything. The task is due in the next 4 days.enter image description here

I don't need answer, i just need to know how it works and so on and i'll do the calculation.

[UPDATE:] Here is my calculation. So the answer for H(k) will be in vector right? If it is, i proceed with the second question but only 1/2 were multiply to the original formula for F(k) right? What can i conclude for the comparisons of both signal? Please correct me if i'm wrong.

$\endgroup$
6
  • $\begingroup$ Where are you stuck? You have the definition of the DCT and a a bunch of numbers. Why don't you just stick the numbers in the definition and see what you get ? $\endgroup$ – Hilmar Jan 30 at 15:16
  • $\begingroup$ @Hilmar For computing the DCT in (i) i just have to do the calculation like the DFT right? I get confused because the x(n) given is like in matrix form or was i wrong about this? $\endgroup$ – NURA Jan 30 at 15:21
  • $\begingroup$ I don't understand what you mean by "like the DFT". You have a formula and an input. Apply the formula to the input. The input is given as a vector. Why do you think, it's a matrix ? $\endgroup$ – Hilmar Jan 30 at 15:24
  • $\begingroup$ @Hilmar what about the w(k) I dont understand how to apply that. Let's say i apply the formula to the input, so the answer then will be in vector? How can i show you my calculation so far $\endgroup$ – NURA Jan 30 at 15:31
  • $\begingroup$ If you want to show your work, add it to the question. w(k) just means that for the IDCT you need to multiply the first term of the sum by $1/2$ $\endgroup$ – Hilmar Jan 30 at 16:38
0
$\begingroup$

I can't recall which type of DCT your formula refers to, but assuming the formula is right, then the summation in the first equation computes $N$ coefficients of the DCT sequence $F[k]$ of the $N$-point input sequence $x[n]$. A similar interpretation applies to the inverse formula.

The following Matlab/Octave code implements the first formula:

N = 6;              % length of input sequence x[n], and output sequence F[k]
x = [1,0,2,5,3,7];  % the input

F = zeros(1,N);     % the output: DCT coeffs

for k = 0 :N-1
    csum = 0;
    for n = 0: N-1
        csum = csum + 2*x(n+1)*cos((pi/(2*N))*k*(2*n+1));
    end
    F(k+1) = csum;
end
$\endgroup$
4
  • $\begingroup$ You mean the N=8 right? By the way thank you for reaching out $\endgroup$ – NURA Jan 31 at 3:04
  • $\begingroup$ @NURA No, N=6 is used in the example code, but you can modify it for N = 8. By the way, your added solution is wrong... Neither the forward nor the inverse transform is calculated right. Specifically, in the forward calculation F(2), F(4), and F(6) should result in being 0. And in the inverse DCT, you should be using only the first 4 coefficients F(0),F(1),F(2),F(3) in the conputation (that's what I understand from 50%), and assume remaning F(4), F(5), F(6), F(7) as zero, and you should be running the outer summation for $n$ of $x[n]$, not for $k$ of $F[k]$... $\endgroup$ – Fat32 Jan 31 at 14:22
  • $\begingroup$ Can you show me one example for calculation for F(0)/ F(1)/ F(2) or any of it? Because i can't understand what you meant $\endgroup$ – NURA Jan 31 at 14:56
  • $\begingroup$ Of course; given the formula $$F(k) = \sum_{n=0}^{N-1} 2 ~ x[n] ~ \cos(\frac{\pi}{2N} (2n+1) k ) $$ and for the given $x[n] = [2,4,6,8,10,12,14,16]$, F(1) is calculated as : $$F(1) = 2 \times [ 2 \cos(\frac{\pi}{16})+4 \cos(\frac{\pi}{16} 3)+6 \cos(\frac{\pi}{16} 5)+8 \cos(\frac{\pi}{16} 7)+10 \cos(\frac{\pi}{16} 9)+12 \cos(\frac{\pi}{16} 11)+14 \cos(\frac{\pi}{16} 13)+16 \cos(\frac{\pi}{16} 15) ] = -51.53$$ $\endgroup$ – Fat32 Jan 31 at 19:06

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.