当前位置: 代码迷 >> python >> 归一化自动关联产生的温度数据
  详细解决方案

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

热度:132   发布时间:2023-06-21 10:58:16.0

我有温度信号和应变信号。 我已经使用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()

文件数据文件

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

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])

我已经在用代码发布了类似的答案

要在正确的位置接收峰,必须除以求和元素的数量。 使用numpy / scipy函数可以很容易地忽略它,这些函数求和但不除以长度。

关于 。

  相关解决方案