I am trying to calculate the original equation using a DFT. I start with a equation, generate values from this equation and then get the dft of these values. The aim is to generate the original equation using the dft values.

Consider the following equation $$f(t) = 1 + 0.75\cos(2\pi t/4) + 0.2\cos(4\pi t/4) + 0.5\cos(6\pi t/4)$$

original signal for $t=[0,1,2,3]\Rightarrow [2.45,0.80,-0.05,0.80]$

DFT: $[4,2.5,0.8,2.5]$

From DFT (i.e $[4,2.5,0.8,2.5]$) how do I retrieve the coefficient $0.75, 0.2$ and $0.5$ present in the original equation?

Cheers, Ambi.

  • $\begingroup$ Would you mind revising your question and double checking everything? It looks like numbers that you provided are not correct. Anyway - keep in mind to divide the FFT by number of samples (in the most simple case) and then you can consider frequency components. Obviously the last two in your case are summing up to 0.7, so I think it's wrong to start with... $\endgroup$ – jojek Nov 30 '15 at 23:20
  • $\begingroup$ Hi jojek, edited the question. Values 0.75, 0.2 and 0.5 are not DFT but the coefficients of cos components in the original equation. Why do I need to divide them by number of samples? $\endgroup$ – user1163441 Dec 1 '15 at 1:03
  • $\begingroup$ The frequency 6 $\pi$ / 4 = 1.5 $\pi$ is too high. It is higher than the Nyquist frequency $\pi$ so your sampling aliases it to another frequency. $\endgroup$ – Olli Niemitalo Dec 1 '15 at 7:48

At first glance your first paragraph seemed wildly confusing to me. (The notion of "calculating" an equation makes no sense.) But now I see what your professor is asking of you. He wants you to determine the coefficients of an equation. He gave you a continuous $f(t)$ equation of a signal containing a DC component (1cos(0$\pi$$t$/4) and three sinusoids. And the 2nd and 3rd sinusoids have frequencies that are integer multiples of the 1st sinusoid.

So, your prof wants you to select the values and length ($N$) of a $t$ time sequence that will make those sinusoids reside exactly at an $N$-point DFT's bin centers. When that happens the bin centers' frequencies will give you the frequencies of the three sinusoids in your $f(t)$ equation. The peak values of the non-zero DFT spectral components (DC plus the three sinusoids) will enable you to establish the [1, 0.75, 0.2, 0.5] peak amplitude coefficients in your $f(t)$ equation. Your prof wants you to learn how a sinewave whose peak amplitude is $A$ produces a DFT spectral component magnitude value of $M$ given the $N$ length of your DFT. Your job is to see how $A$, $M$, and $N$ are related to each other. This is a good homework problem.

Your $t$ = [0,1,2,3] sequence's period is one which means your sample rate is 1 sample/second. And as Ollie said, that's too slow. Set your $t$ sequence to [0, 0.5, 1, 1.5, 2, ..., 6.5, 7, 7.5], compute a 16-point DFT, compute the spectral magnitudes, and see what happens .

  • $\begingroup$ Thx Rich. Set t sequence to [0, 0.5, 1, 1.5, 2, ..., 6.5, 7, 7.5], computed a 16-point DFT The spectral magnitudes are 16,6,1.6 and 4. How do I get the coefficient [1,075,.2,.5] from these magnitudes? Cheers, Ambi. $\endgroup$ – user1163441 Dec 1 '15 at 12:42
  • $\begingroup$ @user1163441 : Do you have a $\frac{1}{N}$ factor missing from your definition of the DFT? $\endgroup$ – Peter K. Dec 1 '15 at 13:09
  • $\begingroup$ Many thanks Richard and Peter. Your input was very helpful indeed. I have now managed to get the coefficient[[1,0.75,0.2,0.5] from dft DFT=[16,6,1.6, 4], .This is how I got them. coefficient of cos component[n]=real component[n]/(N/2), coefficient of cos component[0]=real component[0]/(N), N being 16 in mycase DFT=[16,6,1.6, 4], coefficient of cos(2π 0t/4)=16/16=1, coefficient of cos(2π 1t/4)=6/(16/2)=6/8=0.75, coefficient of cos(2π 2t/4)=1.6/(16/2)=1.6/8=0.2, coefficient of cos(2π 3t/4)=4/(16/2)=4/8=0.5, $\endgroup$ – user1163441 Dec 1 '15 at 20:38
  • $\begingroup$ @user1163441: Your scheme only works because your f(t) contains cosine waves. If f(t) comprised sine waves, instead of cosine waves, your 'DFT real-part component' method will not work. Recall that I suggested you compute the DFT magnitudes and then use those magnitude values to develop a scheme for computing f(t)'s sinusoids' peak amplitude values. (Again, all of this only works if the spectral components reside EXACTLY at DFT bin centers.) $\endgroup$ – Richard Lyons Dec 2 '15 at 15:28

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.