归一化自动关联产生的温度数据

时间:2018-09-23 16:19:19

标签: python signal-processing correlation

我有温度信号和应变信号。 我已经使用np.correlate(..., "same")计算了两个信号的ACF,所以现在我得到了一个与输入长度相同的相关信号。

我使用np.correlate(Temperature, Strain,"same")将温度与应变相关联。

我得到一个相关信号,然后通过计算最大峰值来进行移位。

现在,相关的温度信号的幅度非常高,我想将其标准化为0度到40度。

我该怎么做?

 # ACF between two components
    x1x2 = np.correlate(normalized[:,0], ydatanew, 'same')

    # see the results
    f = plt.figure()
    ax = f.add_subplot(111)
    ax.set_title('ACF')
    ax.plot(x1x2)
    peaks_indices = signal.find_peaks_cwt(x1x2, np.arange(1,10))
    delta_index = np.argmax(peaks_indices);
    print(delta_index)
    shifted_signal = x1x2[delta_index:]
    f = plt.figure()
    ax = f.add_subplot(111)
    ax.set_title("shifted temperature Signal")
    ax.plot(shifted_signal)
    # mainloop
    plt.show()

enter image description here

http://www.mediafire.com/file/r7dg7i9dacvpl2j/curve_fitting_ahmed.xlsx/file 数据文件

2 个答案:

答案 0 :(得分:0)

您是说要进行线性插值吗?如果是这样:

import numpy
a = numpy.random.normal(size=20)
numpy.interp(a, (a.min(), a.max()), (0, 40))
array([23.84183492, 26.07583446,  0.        ,  7.39940903, 16.78754596,
       15.42560512, 40.        , 24.08125307, 23.23089914, 24.66628223,
       9.18832629, 26.16217936, 25.04153859, 26.3898786 , 34.59643449,
       25.15859023, 23.27551679, 27.92135125, 15.41054983, 21.61565544])

答案 1 :(得分:0)

我将其发布为一个类似的答案,其代码为here

要在正确的位置接收峰,必须除以求和元素的数量。可以使用numpy / scipy函数轻松地忽略这一点,该函数求和但不除以长度。

关于definition