Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I want to normalize the FFT used in scilab in a way so that the absolute values of the coefficients equal to the amplitudes of the time domain signal with that frequency.

Example: I want an input sine [0, 5.5, 0, -5.5] to transform to [0, 5.5, 0, 5.5] (absolute values).

For that I used some very simple sines and cosines with an amplitude of 1, and transformed them to see what the fft yields. N is the sample size.

// cos, N = 4
-->fft([1  0  -1  0])
ans  =
0.    2.    0.    2.    // looks like I have to divide by N/2

// sin, N = 4
-->fft([0  1  0  -1])
ans  =
0  - 2.i    0    2.i    // same conclusion

// sin, N = 8 (2 periods)
-->abs(fft([0  1  0  -1  0  1  0  -1]))
ans  =
0.    0.    4.    0.    0.    0.    4.    0.      // same conclusion

// cos, N = 8
-->abs(fft([1  0.7  0  -0.7  -1  -0.7  0  0.7]))
ans  =
0.    3.98    0.    0.02    0.     0.02    0.    3.98  // same conclusion

But:

// cos, N = 2
-->abs(fft([1  -1]))
ans  =
0.    2.      // looks like I have to divide by N

// cos, N = 1
-->abs(fft([1]))
ans  =
1.      // looks like I have to divide by N

The N/2 rule also applies to much larger values for N, but not for N = 2 and N = 1. Is this mathematically explainable, or is scilab's FFT scaling just arbitrary? Or am I missing something basic?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

It's not a matter of $N$ being $1$ or $2$. What's going on is that for most of your examples, the FFT has two nonzero entries at $k$ and $N-k$, where $k$ corresponds to the frequency of your sinusoid. But when $k=0$ (your last example) or $k=N/2$ (your second-last example), these two entries coincide, so the value appears to be twice what you expect.

share|improve this answer
    
I had to read your answer 5 times, but when I looked at the FFT results, the scales fell from my eyes. Thank you! –  dialer Dec 26 '12 at 16:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.