[SciPy-User] Help with fast fourier transform
Thu Apr 29 22:42:40 CDT 2010
Your output looks correct. Most fft functions will give you the 0 frequency in the zeroeth output element, and the -ve frequencies in the second half of the array. It's more effcient to do it this way, and is clearly stated in the docs for fft. What you're probably after is fftshift (which can be found in the same palce as fft etc...) and swaps the halves of the array to give you the more traditional representation with the 0 frequency in the centre.
----- Original Message ----
From: Oscar Gerardo Lazo Arjona <email@example.com>
Sent: Fri, 30 April, 2010 4:17:09 AM
Subject: [SciPy-User] Help with fast fourier transform
Hello! I'm new to this mailing list and to numpy in general.
I need to calculate fft for my optics class. But I'm having trouble.
This is the code I'm using (commented):
import numpy as np
if x>450 and x<550:
f=[g(x) for x in range(0,1000)]
#this funtion can be ploted as
#which is a step function "centered" at 500
#when calculate the fft of f i get an array of complex numbers
#whose absolute value can be ploted as
#But that is not the desired output.
#Instead of that i expect something that can be ploted like this
#what i think must be happening because my function f
#has an offset of 500 (it's supposed to be centereed at 500)
#So i think it all reduces to two options:
#somehow telling fft to consider the origin at 500
#(indicate thetell the offset)
#Or make fft accept a list of points like
#so that it can know the position of the step relative to the origin
SciPy-User mailing list
More information about the SciPy-User