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 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 !

share|improve this question
1  
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

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.