我想重建一个我有一些数据的信号,并使用LombScargle来获取其频率分量。
此外,我的数据还如下:
r = np.array([119.75024144, 119.77177673, 119.79671626, 119.81566188,
119.81291201, 119.71610143, 119.24156708, 117.66932347,
114.22145178, 109.27266933, 104.57675147, 101.63381325,
100.42623807, 100.09436745, 100.02798438, 100.02696846,
100.05422613, 100.12216521, 100.27569606, 100.60962812,
101.32023289, 102.71102637, 105.01826819, 108.17052642,
111.67848758, 114.78442424, 116.95337537, 118.19437002,
118.84307457, 119.19571404, 119.40326818, 119.53101551,
119.61170874, 119.66610072, 119.68315253, 119.53757829,
118.83748609, 116.90425868, 113.32095843, 108.72465638,
104.58292906, 101.93316248, 100.68856962, 100.22523098,
100.08558767, 100.07194691, 100.11193397, 100.19142891,
100.33208922, 100.5849306 , 101.04224415, 101.87565882,
103.33985519, 105.63631456, 108.64972952, 111.86837667,
114.67115037, 116.69548163, 117.96207449, 118.69589499,
119.11781077, 119.36770681, 119.51566311, 119.59301667])
z = np.array ([-422.05230434, -408.98182253, -395.78387843, -382.43143962,
-368.92341485, -355.26851343, -341.47780372, -327.56493425,
-313.54536462, -299.43740189, -285.26768576, -271.07676026,
-256.92098157, -242.86416227, -228.95449427, -215.207069 ,
-201.61590575, -188.17719265, -174.89201262, -161.75452196,
-148.74812279, -135.85126854, -123.04093538, -110.29151714,
-97.57502515, -84.86119278, -72.1145478 , -59.2947726 ,
-46.36450604, -33.29821629, -20.08471733, -6.72030326,
6.80047849, 20.48309726, 34.32320864, 48.30267819,
62.393214 , 76.56022602, 90.76260159, 104.94787451,
119.04731699, 132.98616969, 146.71491239, 160.23436159,
173.58582543, 186.81849059, 199.96724955, 213.05229133,
226.08870416, 239.09310452, 252.08377421, 265.0769367 ,
278.08234368, 291.10215472, 304.13509998, 317.18351924,
330.25976991, 343.38777732, 356.59626164, 369.90725571,
383.33109354, 396.87227086, 410.5309987 , 424.2899438])
plt.plot(z,r, label='data');plt.legend()
然后,我在此数据上使用LobmbScargle:
f, a = LombScargle(z, r).autopower()
plt.plot(f, a, label='frequency components');plt.legend()
类似于傅立叶级数,我想用正弦或余弦的总和来重构信号。
我主要对查找a_i和w_i值感兴趣。
我喜欢以下内容,但是我的重建看起来不像我拥有数据的信号。
s = 0
for i in range(f.shape[0]):
s += a[i]*np.sin(f[i]*z)
plt.plot(z, s, label='reconstructed signal');plt.legend()
在我使用Lomb-Scargle的方式上或在信号重构部分有错误,但是我还没有弄清楚是什么。