# Non zero components in DFT

I wanted to do a simple example of DFT computation using the following python code (numpy + scipy). I am posting here because I am sure my problem is more related to my comprehension of the DFT transform rather than to this particular implementation. The code is:

import numpy as np
import scipy.fftpack as ft

listX = np.linspace(0.,5.*2.*np.pi,100)
sinFunc = np.sin(listX-np.pi)

sinFuncFft = ft.fft(sinFunc)


I expected sinFuncFft to contain null components, except at the 5 and 95 rows. This is not the case, and I would be interested by any insights as to why.

Cheers !

-
Try making the length of listX 101, instead, and then removing the last value from the array. Do you see why that works? –  cardinal Jan 16 '12 at 16:58
The 0 value was repeated, hence the periodic function was not a sine. Thank you ! –  vkubicki Jan 16 '12 at 20:18
add comment