经过复杂的FFT分析后,我的数据为“
y=np.array([-0.31757207, -0.759897 , -0.97481323, -0.90067096, -0.56201419,
-0.06141066, 0.45184696, 0.82654122, 0.95429599, 0.80098432,
0.41565507, -0.08528661, -0.55350349, -0.85289024, -0.89924892,
-0.6838725 , -0.27446443, 0.20632688, 0.61789554, 0.84295248,
0.82091852, 0.56394004, 0.15139964, -0.29481341, -0.64650262,
-0.80602096, -0.73317927, -0.45486384, -0.0552602 , 0.3498015 ,
0.64649953, 0.75486814, 0.64997615, 0.36696461, -0.01077531,
-0.37629244, -0.62928397, -0.70331519, -0.58277349, -0.30541445,
0.04956568, 0.38413122, 0.60823604, 0.66362602, 0.53848173,
0.26941065, -0.06930203, -0.38601383, -0.59612545, -0.6442082 ,
-0.5182447 , -0.25246689, 0.08181356, 0.39497462, 0.60264688,
0.6480463 , 0.51731067, 0.24376628, -0.10019951, -0.42181997,
-0.63254052, -0.67215727, -0.52601037, -0.23032442, 0.13622702,
0.47298468, 0.68464621, 0.70816855, 0.53165966, 0.19956061,
-0.19797826, -0.54920882, -0.75206661, -0.74391156, -0.52103408,
-0.14180003, 0.28818356, 0.64528143, 0.82341019, 0.76573576,
0.48295615, 0.05224223, -0.40355087, -0.75089961, -0.88488436,
-0.76111445, -0.41051563, 0.06797007, 0.53521743, 0.85248562,
0.92285209, 0.72105995, 0.30251038, -0.21178154, -0.67024193,
-0.935627 , -0.92637938, -0.64190028, -0.16383967, 0.36735054,
0.79386302, 0.98768951, 0.88930233, 0.52608786, 0.00477518,
-0.52006527, -0.89210845, -1.00012051, -0.8114311 , -0.3818889 ,
0.16075761, 0.65507887, 0.95427369, 0.97001733, 0.69866763,
0.22200955])
当绘制时,会生成:
这是具有可变幅度的余弦函数。我正在寻找一种方法来摆脱振幅包络,以获得我能够适合的正常余弦函数。
答案 0 :(得分:0)
来自matplotlib.pyplot导入图,图
来自numpy import array,exp,arange,real,append
来自scipy.fftpack import fft,ifft
w = fft(y)
f = arange(0,y.size)
cf = 10 #central freq
wd = 0.5 #width
gate1 = exp( - ((f-cf)/(0.707106 * wd))**(2 * 2))
gate2 = append([0],gate1 [:: - 1])[: - 1] #symmetrize
gate = gate1 + gate2
w_f = w * gate
图(1)
积(ABS(W))
积(ABS(w_f))
图(2)
情节(实部(IFFT(w_f)))