2
$\begingroup$

I am trying to implement Discrete Fourier Transform (by definition, in quadratic time).

I wrote this http://jsfiddle.net/uunsm/12/

My result function really goes through discrete points, but it is too "wavy".

When I inserted a sine wave:

var nums = [0.000, 0.707, 1.000, 0.707, 0.000, -0.707, -1.000, -0.707] 

I was expecting to get a smooth sine, but again, there are too many "waves". Am I doing anything wrong?

BTW. I found this implementation http://home.fuse.net/clymer/graphs/dft.html which is much smoother. Is it still Fourier transform? Where can I find any info about that algorithm?

  • 0
    This is more related to programming I guess. Now what is the question? errors in your code? or if your code is correct?2012-09-05
  • 0
    I wanted to know if it is the correct behavior, or if I have any errors.2012-09-05
  • 0
    The behavior that you are seeing is correct. It is called Gibbs Phenomenon (see http://en.wikipedia.org/wiki/Gibbs_phenomenon). It is a natural artifact of trying to represent a non-continuous function (i.e. step) with a set of continuous functions (i.e. sinusoids).2012-09-06

1 Answers 1