我正在尝试计算Python中非周期数据的傅立叶变换,而不是期刊,我的意思是。通常,我们使用定期数据:
x=[0,1,2,3,4,5,6,7]
y=[1,0,2,0,1,0,1,0]
并且可以轻松获得傅立叶变换和频域,
from scipy.fft import fft, fftfreq, fftshift
f=fftfreq(len(x), dx)
fy=fft(y)
并且我们可以使用 scipy fft
轻松地计算傅立叶变换,但是在这种情况下,我们的数据并不确切。例如,
x=[0,1,1.5,1.7,3,4,5...]
y=[...]
任何人都有一些想法,即如果可能的话,如何使用Python或使用的数学原理获得傅立叶变换。
I'm trying to calculate the Fourier transform of non periodical data in python, with non periodical I mean this. Usually we use have periodical data:
x=[0,1,2,3,4,5,6,7]
y=[1,0,2,0,1,0,1,0]
And the Fourier transform and the frequency domain can be obtained easily,
from scipy.fft import fft, fftfreq, fftshift
f=fftfreq(len(x), dx)
fy=fft(y)
And with that we can easily calculate the Fourier transform using scipy fft
, but in the case our data is not exactly periodical, for example,
x=[0,1,1.5,1.7,3,4,5...]
y=[...]
Anyone have some idea of how can be possible to obtain the Fourier transform using python if it's possible, or the mathematics principles that are used.
发布评论
评论(2)
对于此类数据,您可以使用“ nofollow noreferrer”>最小二乘光谱分析。 scipy包括函数 计算Lomb-Scargle期刊。 Docstring有一个例子;请参阅离散的傅立叶转换,从xy点列表另一个示例。
For such data, you can use least-squares spectral analysis. SciPy includes the function
scipy.signal.lombscargle
that computes the Lomb-Scargle periodogram. The docstring has an example; see Discrete fourier transformation from a list of x-y points for another example.您不能执行不均匀采样信号的FFT。这使FFT基于数学的假设无效。
您必须重新采样信号,以便您有均匀间隔的样品。
请阅读此信息以获取更多信息: https://dsp.stackexchange.com/questions/8488/what-is-an-algorithm-to-re-sample-from-a-a-variable-a-a-variable-a-a-variable-a-a-variable-a-a-a-fixed-rate < /a>
You can't do an FFT of an unevenly sampled signal. That invalidates the assumptions of the math the FFT is based upon.
You'll have to resample the signal so you have evenly spaced samples.
Read this for more information: https://dsp.stackexchange.com/questions/8488/what-is-an-algorithm-to-re-sample-from-a-variable-rate-to-a-fixed-rate