|
|
|
|
|
by eliteraspberrie
4444 days ago
|
|
The faster way of doing this: def fourier_transform(signal, period, tt):
""" See http://en.wikipedia.org/wiki/Fourier_transform
How come Numpy and Scipy don't implement this ??? """
f = lambda func : (signal*func(2*pi*tt/period)).sum()
return f(cos)+ 1j*f(sin)
is using the FFT.What you want is the power spectral density in the discrete case, called the power spectrum. It can be calculated by multiplying the discrete Fourier transform (FFT) with its conjugate, and shifting. NumPy can do it. Here is an example: http://stackoverflow.com/questions/15382076/plotting-power-s... |
|
If someone knows a way to use the FFT to get non-integer periods (apart from oversampling the signal) I'll gladly change the code.