Created
August 16, 2012 17:08
-
-
Save jaidevd/3371737 to your computer and use it in GitHub Desktop.
Harshad's problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You need to have matplotlib installed to be able to plot anything in Python. | |
# Suppose your data is a variable 'data' | |
from matplotlib.pyplot import plot, show | |
try: | |
from numpy.fft import fft | |
except: | |
from numpy import fft | |
x = data[:,1] # 2nd column | |
y = data[:,4] # 5th column | |
plot(x,y) | |
show() | |
# you should be able to see the plot now in a popped up window. | |
F1 = fft(*) # whatever you want to take an fft of, goes in the place of the * | |
figure() | |
plot(abs(F)) | |
show() | |
# another popped up window showing the FFT amplitude spectrum | |
# Do the same with the other text file and call the other FFT F2 | |
F_div = abs(F1)/abs(F2) | |
# the division of the two FFTs. |
FFT of column 5 with a sampling period calculated by averaging column 2 values. Same for both the text files
Install numpy, scipy and matplotlib. Are you using windows?
yes - windows; how do i use the packages? Any guide books?
search for the windows installers for numpy and matplotlib
in the program why have you done the "try: ........ except:......" thing?
I'm not sure if the fft function is available directly in numpy or if it is a part of another module 'fft' within numpy. If it is the latter case, the try loop will be run.
It's possible that there is a module called numpy.fft which has all Fourier related methods, and the fast Fourier transform is one of them, in which case the function in numpy.fft.fft
Else it could just be numpy.fft
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Help me getting started (spoon feeding will be better ;p) on what packages to install and how to use them. I have installed PyScripter where I write my programs.