Electronic – Why are these Fourier transform values not as expected

fourier

We are being taught Fourier Transform in our EE course this semester and I have several questions about it. The answers do not need to be rigorous and mathematical, all I need is an intuitive 'feel' of the Fourier Transform. I may be completely wrong at certain points so feel free to point it out.

  1. Is the FT of a continuous function \$ x(t) \$ approximately equal to the DFT of the discreet-time version of the same function?
    In other words, if

    • \$ X(\omega) \$ if the FT of \$ x(t) \$
    • \$T\$ is an array containing closely spaced values of time (for example [-10:0.001:10])
    • \$y\$ is an array containing \$x(t)\$ \$ \forall\$ \$ t\in T\$
    • \$ Y \$ is an array containing the DFT of y
    • \$ Y'\$ contains values of \$ X(\omega) \$ for corresponding \$ \omega\$
      Then is \$Y \approx Y'\$
  2. Can someone please explain the result of the following code

    t = [-10:0.001:10]
    x = sin(t)
    y = fft(x)
    z = abs(real(y))
    

    I expected z to be an array of real numbers containing a sharp peak as the FT of a function gives the spectrum of frequencies contained in the fourier series representation of the function. But it turned out that the maximum was 4.32 and the mean of all values of the array was 0.55, which does not seem to be what I expected.
    Is there something wrong in the way I am interpreting the fourier transform? How do I need to proceed if I need to calculate the frequency spectrum of this function?

Best Answer

  1. Intuitively the DFT and FT are similar. As the other poster pointed out, the main difference is that sampling in the time domain is equivalent to repetition in the Frequency domain, so the DFT will have repeated spectra at multiples of the sample frequency.

  2. Two problems here.

    i) abs(real(y)) is incorrectly being used. You need the absolute value (or magnitude) of both the imaginary and real components ... abs(y).

    ii) You're seeing the effect of spectral leakage because the DFT assumes a repetitive signal; i.e. the maths "assumes" the signal you applied is repeated infinitely. Your signal will have discontinuities in this case.

Try the following code:

t = [-10*pi:pi/10:9.9*pi]
x = sin(t)
y = fft(x)
z = abs(y)

You should see this:

enter image description here