我问了一个关于如何从时间序列数据确定傅立叶系数的已删除问题。我重新提交这个问题是因为我已经更好地阐述了这个问题,并且有一个解决方案,我将给出这个解决方案,因为我认为其他人可能会发现这非常有用。
我有一些时间序列数据,我已将它们分箱到等间隔的时间箱中(这一事实对我的解决方案至关重要),并且从这些数据中我想确定最能描述数据的傅里叶级数(或任何函数,实际上) 。这是一个带有一些测试数据的 MWE,用于显示我想要拟合的数据:
import numpy as np
import matplotlib.pyplot as plt
# Create a dependent test variable to define the x-axis of the test data.
test_array = np.linspace(0, 1, 101) - 0.5
# Define some test data to try to apply a Fourier series to.
test_data = [0.9783883464566918, 0.979599093567252, 0.9821424606299206, 0.9857575507812502, 0.9899278899999995,
0.9941848228346452, 0.9978438300395263, 1.0003009205426352, 1.0012208923679058, 1.0017130521235522,
1.0021799664031628, 1.0027475606936413, 1.0034168260869563, 1.0040914266144825, 1.0047781181102355,
1.005520348837209, 1.0061899214145387, 1.006846206627681, 1.0074483048543692, 1.0078691461988312,
1.008318736328125, 1.008446947572815, 1.00862051262136, 1.0085134881422921, 1.008337095516569,
1.0079539881889774, 1.0074857334630352, 1.006747783037474, 1.005962048923679, 1.0049115434782612,
1.003812267822736, 1.0026427549407106, 1.001251963531669, 0.999898555335968, 0.9984976286266923,
0.996995982142858, 0.9955652088974847, 0.9941647321428578, 0.9927727076023389, 0.9914750532544377,
0.990212467710371, 0.9891098035363466, 0.9875998927875242, 0.9828093773946361, 0.9722532524271845,
0.9574084365384614, 0.9411012303149601, 0.9251820309477757, 0.9121488392156851, 0.9033119748549322,
0.9002445803921568, 0.9032760564202343, 0.91192435882353, 0.9249696964980555, 0.94071381372549,]
# Create a figure to view the data.
fig, ax = plt.subplots(1, 1, figsize=(6, 6))
# Plot the data.
ax.scatter(test_array, test_data, color="k", s=1)
输出如下:
问题是如何确定最能描述该数据的傅里叶级数。确定傅里叶系数的常用公式需要在积分中插入一个函数,但如果我有一个函数来描述数据,我根本不需要傅里叶系数;找到这个系列的全部目的是获得数据的函数表示。如果没有这样的函数,那么,系数是如何找到的呢?
慕桂英4014372
慕勒3428872
相关分类