Investigating an Unexpected Result with DFT: Examining Example 1

  • Thread starter Thread starter btb4198
  • Start date Start date
  • Tags Tags
    Dft Example
AI Thread Summary
The discussion revolves around confusion regarding the Discrete Fourier Transform (DFT) and its expected outputs. Participants express frustration over discrepancies in results, particularly concerning the coefficients for specific frequency bins and the normalization factor 1/N. There is a consensus that the DFT should yield distinct frequency components, but issues arise with aliasing and the interpretation of results from different examples. Recommendations include reviewing digital signal processing fundamentals and performing calculations by hand to clarify misunderstandings. The conversation highlights the complexities of DFT and the need for careful attention to detail in calculations.
btb4198
Messages
570
Reaction score
10
ok this is the best example i could find of DFT
http://faculty.ksu.edu.sa/ghulam/Documents/CEN352/DSP_CEN352_ch4_DFT.pdf

example 1)
this is what I am trying to do...
however it did not work for the guy...

f[1] should be the only one with an value
but it was a j0.5 and he got that for ever N-3..
why?

DFT should only return the frequency of the signal right?
so it should only return 1...
so why did it not work?
is he doing someone wrong in Example one ?
 
Engineering news on Phys.org
The spectrum repeats (aliases) about the sample rate. The basic DFT is from -2 to +2 and has a value in the +1 and -1 bins. If you only look at the -2,-1,0,+1,+2 bins you see what you'd expect.

His first example was pretty clean.
 
ok I get what you are saying however I do not understand the " You wee what you'd expect" .

Wiki " In mathematics, the discrete Fourier transform (DFT) converts a finite list of equally spaced samples of a function into the list of coefficients of a finite combination of complex sinusoids, ordered by their frequencies, that has those same sample values. It can be said to convert the sampled function from its original domain (often time or position along a line) to the frequency domain."

so I would expect to see f[1] having a coefficients with a right number and the other to be 0.

ok I am very new to this. so what am I missing ?

also he has f[r] = 1/N Ʃ x(k) e^((-j2πfK)/n) for example 1 but for example 2 he does not have the 1/N.. when do you need the 1/N part?
 
The 1/N part is always confusing. You sometimes need to normalize. I can't easily explain it. Remember how you got 16 on a 16 sample sine wave? The 1/N would have made it 1. Some derivations use 1/sqrtN on both DFT and IDFT, some use 1/N on DFT, maybe some do 1/N on IDFT. A DSP expert could explain it better. It is just a scaling factor.

This example has both positive and negative frequency, so there is energy in both the +1 and -1 bins. (it reflects around 0)

I really recommend watching some lectures on DSP that address the fundamentals of discrete signals.
 
what happened if you add two signals with the same frequency together ?
 
If you add two signals with same frequency f1 ,Y[t]=A1*sin(2*pi*f1*t)+A2*sin(2*pi*f1*t) then when you compute the DFT, you get the max of the spectrum as the sum of theirs amplitudes A1+A2 at frequency f1 such f1 in [0, Fs] .
 
KHMOU YOUSSEF said:
If you add two signals with same frequency f1 ,Y[t]=A1*sin(2*pi*f1*t)+A2*sin(2*pi*f1*t) then when you compute the DFT, you get the max of the spectrum as the sum of theirs amplitudes A1+A2 at frequency f1 such f1 in [0, Fs] .

could you do the math and post it ?
because I am really starting to think that the DFT does not work..
I have see many examples online and none return the right frequency
 
what software are you using, ? here is an example using Matrix Laboratory :

Fs=80;
f=35;
t=(0:1/Fs:2-1/Fs);
a1=2;
a2=5;
y=a1*real(exp(j*2*pi*f*t))+a2*real(exp(j*2*pi*f*t));
n=length(y);
fy=fft(y,n)*2/n;
freq=(0:n-1)*Fs/n;
plot(freq(1:end/2), abs(fy(1:end/2)))
 
I am write my on code in c# and I am going it by hand

so this is from math lab
x[n] = {1 –1 1 –1}

>> x = [1 -1 1 -1];
>> X = fft(x)
*
X =
*
0 0 4 0

*
4 0 0 0

but that is Wrong!
Math lab is wrong!

I did it by hand I got this
i used
3
F[r] = Ʃ F[K]ε ^(-j 2πKr)/N
K=0
F[0] = 1 -1 +1 -1 = 0
F[1] = 1 + j +1 - J = 2
F[2] = 1 -1 -1 -1 = -2
f[3] = 1 +j +1 - j = 2
I do not understand
what is wrong with math lab ?

what it math lab doing ?
 
  • #10
I do not have Matrix Laboratory
can you do it by hand and post it that way?
 

Similar threads

Back
Top