如何使用Python测量Numpy数据与模式/模型/函数之间的近似匹配?

发布于 2025-01-20 12:02:03 字数 3905 浏览 1 评论 0原文

我有一些数据点(x和y),我想检查以下哪个模型与数据点匹配:

  1. y = x^2
  2. y = -x^2 < /code>
  3. y = 0

我想考虑一个大小35的窗口,然后移动窗口,并在每个步骤中验证数据点与上述模型的主管匹配。

换句话说,我打算发现每个数据点是否最有可能继续直线。否则数据点将继续增加趋势曲线(这是一条最小后面的曲线);或者它将继续降低趋势曲线(这是一条最大后面的曲线)。

y = np.array([[1.6396475],
       [1.6396625],
       [1.639665 ],
       [1.6395325],
       [1.6396125],
       [1.6394225],
       [1.6389825],
       [1.6388175],
       [1.63901  ],
       [1.6389325],
       [1.63897  ],
       [1.638955 ],
       [1.638855 ],
       [1.638905 ],
       [1.639    ],
       [1.639305 ],
       [1.6393875],
       [1.6393675],
       [1.63916  ],
       [1.63879  ],
       [1.638545 ],
       [1.6384525],
       [1.638495 ],
       [1.6385625],
       [1.6383125],
       [1.6382875],
       [1.6384075],
       [1.6382775],
       [1.6382975],
       [1.6383525],
       [1.6387725],
       [1.639285 ],
       [1.6397525],
       [1.6400825],
       [1.6403925],
       [1.64065  ],
       [1.641025 ],
       [1.6409375],
       [1.6407275],
       [1.64112  ],
       [1.6416275],
       [1.641705 ],
       [1.6419825],
       [1.642025 ],
       [1.641535 ],
       [1.6412825],
       [1.641395 ],
       [1.6413375],
       [1.641145 ],
       [1.6411725],
       [1.6412975],
       [1.641525 ],
       [1.641715 ],
       [1.6416025],
       [1.64136  ],
       [1.640975 ],
       [1.6402425],
       [1.64007  ],
       [1.640575 ],
       [1.6408675],
       [1.6407075],
       [1.6403825],
       [1.6402525],
       [1.64014  ],
       [1.6400675],
       [1.6397975],
       [1.639635 ],
       [1.63979  ],
       [1.6397275],
       [1.639685 ],
       [1.63938  ],
       [1.6392375],
       [1.63906  ],
       [1.6387775],
       [1.638465 ],
       [1.638495 ],
       [1.6387   ],
       [1.6384675],
       [1.6382575],
       [1.63833  ],
       [1.6382725],
       [1.63815  ],
       [1.6381175],
       [1.63801  ],
       [1.637945 ],
       [1.637915 ],
       [1.637885 ],
       [1.6381025],
       [1.638095 ],
       [1.637975 ],
       [1.6378325],
       [1.637945 ],
       [1.6382925],
       [1.63824  ],
       [1.63781  ],
       [1.6375275],
       [1.6375875],
       [1.63764  ],
       [1.637715 ],
       [1.637785 ]])

x = np.array([[ 0.],
       [ 1.],
       [ 2.],
       [ 3.],
       [ 4.],
       [ 5.],
       [ 6.],
       [ 7.],
       [ 8.],
       [ 9.],
       [10.],
       [11.],
       [12.],
       [13.],
       [14.],
       [15.],
       [16.],
       [17.],
       [18.],
       [19.],
       [20.],
       [21.],
       [22.],
       [23.],
       [24.],
       [25.],
       [26.],
       [27.],
       [28.],
       [29.],
       [30.],
       [31.],
       [32.],
       [33.],
       [34.],
       [35.],
       [36.],
       [37.],
       [38.],
       [39.],
       [40.],
       [41.],
       [42.],
       [43.],
       [44.],
       [45.],
       [46.],
       [47.],
       [48.],
       [49.],
       [50.],
       [51.],
       [52.],
       [53.],
       [54.],
       [55.],
       [56.],
       [57.],
       [58.],
       [59.],
       [60.],
       [61.],
       [62.],
       [63.],
       [64.],
       [65.],
       [66.],
       [67.],
       [68.],
       [69.],
       [70.],
       [71.],
       [72.],
       [73.],
       [74.],
       [75.],
       [76.],
       [77.],
       [78.],
       [79.],
       [80.],
       [81.],
       [82.],
       [83.],
       [84.],
       [85.],
       [86.],
       [87.],
       [88.],
       [89.],
       [90.],
       [91.],
       [92.],
       [93.],
       [94.],
       [95.],
       [96.],
       [97.],
       [98.],
       [99.]])

I have some data points (x and y) and I want to check which of the following models matches the best with the data points:

  1. y = x^2
  2. y = -x^2
  3. y = 0

I want to consider a window of size 35, and move the window, and verify in each step the data points are matching with which of the HEAD of above-mentioned models.

In other words, I intend to discover if each data point is most likely to continue a straight line; or the data point is going to continue an increasing-trend curve (it is a curve with minimum behind); or it is going to continue a decreasing-trend curve (it is a curve with maximum behind).

y = np.array([[1.6396475],
       [1.6396625],
       [1.639665 ],
       [1.6395325],
       [1.6396125],
       [1.6394225],
       [1.6389825],
       [1.6388175],
       [1.63901  ],
       [1.6389325],
       [1.63897  ],
       [1.638955 ],
       [1.638855 ],
       [1.638905 ],
       [1.639    ],
       [1.639305 ],
       [1.6393875],
       [1.6393675],
       [1.63916  ],
       [1.63879  ],
       [1.638545 ],
       [1.6384525],
       [1.638495 ],
       [1.6385625],
       [1.6383125],
       [1.6382875],
       [1.6384075],
       [1.6382775],
       [1.6382975],
       [1.6383525],
       [1.6387725],
       [1.639285 ],
       [1.6397525],
       [1.6400825],
       [1.6403925],
       [1.64065  ],
       [1.641025 ],
       [1.6409375],
       [1.6407275],
       [1.64112  ],
       [1.6416275],
       [1.641705 ],
       [1.6419825],
       [1.642025 ],
       [1.641535 ],
       [1.6412825],
       [1.641395 ],
       [1.6413375],
       [1.641145 ],
       [1.6411725],
       [1.6412975],
       [1.641525 ],
       [1.641715 ],
       [1.6416025],
       [1.64136  ],
       [1.640975 ],
       [1.6402425],
       [1.64007  ],
       [1.640575 ],
       [1.6408675],
       [1.6407075],
       [1.6403825],
       [1.6402525],
       [1.64014  ],
       [1.6400675],
       [1.6397975],
       [1.639635 ],
       [1.63979  ],
       [1.6397275],
       [1.639685 ],
       [1.63938  ],
       [1.6392375],
       [1.63906  ],
       [1.6387775],
       [1.638465 ],
       [1.638495 ],
       [1.6387   ],
       [1.6384675],
       [1.6382575],
       [1.63833  ],
       [1.6382725],
       [1.63815  ],
       [1.6381175],
       [1.63801  ],
       [1.637945 ],
       [1.637915 ],
       [1.637885 ],
       [1.6381025],
       [1.638095 ],
       [1.637975 ],
       [1.6378325],
       [1.637945 ],
       [1.6382925],
       [1.63824  ],
       [1.63781  ],
       [1.6375275],
       [1.6375875],
       [1.63764  ],
       [1.637715 ],
       [1.637785 ]])

x = np.array([[ 0.],
       [ 1.],
       [ 2.],
       [ 3.],
       [ 4.],
       [ 5.],
       [ 6.],
       [ 7.],
       [ 8.],
       [ 9.],
       [10.],
       [11.],
       [12.],
       [13.],
       [14.],
       [15.],
       [16.],
       [17.],
       [18.],
       [19.],
       [20.],
       [21.],
       [22.],
       [23.],
       [24.],
       [25.],
       [26.],
       [27.],
       [28.],
       [29.],
       [30.],
       [31.],
       [32.],
       [33.],
       [34.],
       [35.],
       [36.],
       [37.],
       [38.],
       [39.],
       [40.],
       [41.],
       [42.],
       [43.],
       [44.],
       [45.],
       [46.],
       [47.],
       [48.],
       [49.],
       [50.],
       [51.],
       [52.],
       [53.],
       [54.],
       [55.],
       [56.],
       [57.],
       [58.],
       [59.],
       [60.],
       [61.],
       [62.],
       [63.],
       [64.],
       [65.],
       [66.],
       [67.],
       [68.],
       [69.],
       [70.],
       [71.],
       [72.],
       [73.],
       [74.],
       [75.],
       [76.],
       [77.],
       [78.],
       [79.],
       [80.],
       [81.],
       [82.],
       [83.],
       [84.],
       [85.],
       [86.],
       [87.],
       [88.],
       [89.],
       [90.],
       [91.],
       [92.],
       [93.],
       [94.],
       [95.],
       [96.],
       [97.],
       [98.],
       [99.]])

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜空下最亮的亮点 2025-01-27 12:02:03

在我看来,这是一个长期的问题。我希望其他人可以提供更好的答案。
在这里,我提到一个答案,然后在我附上最终答案的图像之前:

”在此处输入图像描述”

import numpy as np
from scipy.interpolate import interp1d
from scipy.misc import derivative
import matplotlib.pyplot as plt

y = np.array([[1.6396475],
       [1.6396625],
       [1.639665 ],
       [1.6395325],
       [1.6396125],
       [1.6394225],
       [1.6389825],
       [1.6388175],
       [1.63901  ],
       [1.6389325],
       [1.63897  ],
       [1.638955 ],
       [1.638855 ],
       [1.638905 ],
       [1.639    ],
       [1.639305 ],
       [1.6393875],
       [1.6393675],
       [1.63916  ],
       [1.63879  ],
       [1.638545 ],
       [1.6384525],
       [1.638495 ],
       [1.6385625],
       [1.6383125],
       [1.6382875],
       [1.6384075],
       [1.6382775],
       [1.6382975],
       [1.6383525],
       [1.6387725],
       [1.639285 ],
       [1.6397525],
       [1.6400825],
       [1.6403925],
       [1.64065  ],
       [1.641025 ],
       [1.6409375],
       [1.6407275],
       [1.64112  ],
       [1.6416275],
       [1.641705 ],
       [1.6419825],
       [1.642025 ],
       [1.641535 ],
       [1.6412825],
       [1.641395 ],
       [1.6413375],
       [1.641145 ],
       [1.6411725],
       [1.6412975],
       [1.641525 ],
       [1.641715 ],
       [1.6416025],
       [1.64136  ],
       [1.640975 ],
       [1.6402425],
       [1.64007  ],
       [1.640575 ],
       [1.6408675],
       [1.6407075],
       [1.6403825],
       [1.6402525],
       [1.64014  ],
       [1.6400675],
       [1.6397975],
       [1.639635 ],
       [1.63979  ],
       [1.6397275],
       [1.639685 ],
       [1.63938  ],
       [1.6392375],
       [1.63906  ],
       [1.6387775],
       [1.638465 ],
       [1.638495 ],
       [1.6387   ],
       [1.6384675],
       [1.6382575],
       [1.63833  ],
       [1.6382725],
       [1.63815  ],
       [1.6381175],
       [1.63801  ],
       [1.637945 ],
       [1.637915 ],
       [1.637885 ],
       [1.6381025],
       [1.638095 ],
       [1.637975 ],
       [1.6378325],
       [1.637945 ],
       [1.6382925],
       [1.63824  ],
       [1.63781  ],
       [1.6375275],
       [1.6375875],
       [1.63764  ],
       [1.637715 ],
       [1.637785 ]])
x = np.zeros((100,1))
for i in range(0, 100):
    x[i,0] = i
x = np.array([[ 0.],
       [ 1.],
       [ 2.],
       [ 3.],
       [ 4.],
       [ 5.],
       [ 6.],
       [ 7.],
       [ 8.],
       [ 9.],
       [10.],
       [11.],
       [12.],
       [13.],
       [14.],
       [15.],
       [16.],
       [17.],
       [18.],
       [19.],
       [20.],
       [21.],
       [22.],
       [23.],
       [24.],
       [25.],
       [26.],
       [27.],
       [28.],
       [29.],
       [30.],
       [31.],
       [32.],
       [33.],
       [34.],
       [35.],
       [36.],
       [37.],
       [38.],
       [39.],
       [40.],
       [41.],
       [42.],
       [43.],
       [44.],
       [45.],
       [46.],
       [47.],
       [48.],
       [49.],
       [50.],
       [51.],
       [52.],
       [53.],
       [54.],
       [55.],
       [56.],
       [57.],
       [58.],
       [59.],
       [60.],
       [61.],
       [62.],
       [63.],
       [64.],
       [65.],
       [66.],
       [67.],
       [68.],
       [69.],
       [70.],
       [71.],
       [72.],
       [73.],
       [74.],
       [75.],
       [76.],
       [77.],
       [78.],
       [79.],
       [80.],
       [81.],
       [82.],
       [83.],
       [84.],
       [85.],
       [86.],
       [87.],
       [88.],
       [89.],
       [90.],
       [91.],
       [92.],
       [93.],
       [94.],
       [95.],
       [96.],
       [97.],
       [98.],
       [99.]])
def Get_Trends(data=None):
    k1 = 0
    k2 = 35
    KL = k2 - k1
    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend1 = np.average(df_dx)

    k1 = 9
    k2 = 19
    KL = k2 - k1

    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend2 = np.average(df_dx)

    k1 = 19
    k2 = 27
    KL = k2 - k1

    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend3 = np.average(df_dx)

    k1 = 24
    k2 = 30
    KL = k2 - k1

    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend4 = np.average(df_dx)

    k1 = 30
    k2 = 35
    KL = k2 - k1

    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend5 = np.average(df_dx)
    return trend1, trend2, trend3, trend4, trend5

c = 0
tlist2 = []
trends_list = []
for i in range(35, 100):
    trend1, trend2, trend3, trend4, trend5 = Get_Trends(y[i - 35:i, 0])
    if trend1 >= -0.0015678 and (trend5 >= trend4 or trend5 >= trend3 or trend5 >= trend2) \
            and (trend4 >= trend3 or trend4 >= trend2) and trend4 > 0 and trend5 > 0:
           print(str(i+35) + " -X^2")
           plt.plot(x[i], y[i],"^g")

    elif trend1 <= 0.0015678 and (trend5 <= trend4 or trend5 <= trend3 or trend5 <= trend2) \
            and (trend4 <= trend3 or trend4 <= trend2) and trend4 < 0 and trend5 < 0:
           print(str(i+35) + " X^2")
           plt.plot(x[i], y[i], ".r")

    elif np.abs(trend1-trend2) <= 0.001 and np.abs(trend2-trend3) <= 0.001 and np.abs(trend3-trend4) <= 0.001 and np.abs(trend4-trend5) <= 0.001 and np.abs(trend1-trend5) <= 0.001:
           print(str(i+35) + " y= a")
           plt.plot(x[i], y[i],".b")

    else:
           print(str(i+35) + " No model")
           plt.plot(x[i], y[i], ".y")

plt.plot(x,y)
plt.show()

It was a long-time this was a question in my mind. And I hope that others can provide better answers.
Here, I am mentioning an answer, before I am attaching the image of the final answer:

enter image description here

import numpy as np
from scipy.interpolate import interp1d
from scipy.misc import derivative
import matplotlib.pyplot as plt

y = np.array([[1.6396475],
       [1.6396625],
       [1.639665 ],
       [1.6395325],
       [1.6396125],
       [1.6394225],
       [1.6389825],
       [1.6388175],
       [1.63901  ],
       [1.6389325],
       [1.63897  ],
       [1.638955 ],
       [1.638855 ],
       [1.638905 ],
       [1.639    ],
       [1.639305 ],
       [1.6393875],
       [1.6393675],
       [1.63916  ],
       [1.63879  ],
       [1.638545 ],
       [1.6384525],
       [1.638495 ],
       [1.6385625],
       [1.6383125],
       [1.6382875],
       [1.6384075],
       [1.6382775],
       [1.6382975],
       [1.6383525],
       [1.6387725],
       [1.639285 ],
       [1.6397525],
       [1.6400825],
       [1.6403925],
       [1.64065  ],
       [1.641025 ],
       [1.6409375],
       [1.6407275],
       [1.64112  ],
       [1.6416275],
       [1.641705 ],
       [1.6419825],
       [1.642025 ],
       [1.641535 ],
       [1.6412825],
       [1.641395 ],
       [1.6413375],
       [1.641145 ],
       [1.6411725],
       [1.6412975],
       [1.641525 ],
       [1.641715 ],
       [1.6416025],
       [1.64136  ],
       [1.640975 ],
       [1.6402425],
       [1.64007  ],
       [1.640575 ],
       [1.6408675],
       [1.6407075],
       [1.6403825],
       [1.6402525],
       [1.64014  ],
       [1.6400675],
       [1.6397975],
       [1.639635 ],
       [1.63979  ],
       [1.6397275],
       [1.639685 ],
       [1.63938  ],
       [1.6392375],
       [1.63906  ],
       [1.6387775],
       [1.638465 ],
       [1.638495 ],
       [1.6387   ],
       [1.6384675],
       [1.6382575],
       [1.63833  ],
       [1.6382725],
       [1.63815  ],
       [1.6381175],
       [1.63801  ],
       [1.637945 ],
       [1.637915 ],
       [1.637885 ],
       [1.6381025],
       [1.638095 ],
       [1.637975 ],
       [1.6378325],
       [1.637945 ],
       [1.6382925],
       [1.63824  ],
       [1.63781  ],
       [1.6375275],
       [1.6375875],
       [1.63764  ],
       [1.637715 ],
       [1.637785 ]])
x = np.zeros((100,1))
for i in range(0, 100):
    x[i,0] = i
x = np.array([[ 0.],
       [ 1.],
       [ 2.],
       [ 3.],
       [ 4.],
       [ 5.],
       [ 6.],
       [ 7.],
       [ 8.],
       [ 9.],
       [10.],
       [11.],
       [12.],
       [13.],
       [14.],
       [15.],
       [16.],
       [17.],
       [18.],
       [19.],
       [20.],
       [21.],
       [22.],
       [23.],
       [24.],
       [25.],
       [26.],
       [27.],
       [28.],
       [29.],
       [30.],
       [31.],
       [32.],
       [33.],
       [34.],
       [35.],
       [36.],
       [37.],
       [38.],
       [39.],
       [40.],
       [41.],
       [42.],
       [43.],
       [44.],
       [45.],
       [46.],
       [47.],
       [48.],
       [49.],
       [50.],
       [51.],
       [52.],
       [53.],
       [54.],
       [55.],
       [56.],
       [57.],
       [58.],
       [59.],
       [60.],
       [61.],
       [62.],
       [63.],
       [64.],
       [65.],
       [66.],
       [67.],
       [68.],
       [69.],
       [70.],
       [71.],
       [72.],
       [73.],
       [74.],
       [75.],
       [76.],
       [77.],
       [78.],
       [79.],
       [80.],
       [81.],
       [82.],
       [83.],
       [84.],
       [85.],
       [86.],
       [87.],
       [88.],
       [89.],
       [90.],
       [91.],
       [92.],
       [93.],
       [94.],
       [95.],
       [96.],
       [97.],
       [98.],
       [99.]])
def Get_Trends(data=None):
    k1 = 0
    k2 = 35
    KL = k2 - k1
    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend1 = np.average(df_dx)

    k1 = 9
    k2 = 19
    KL = k2 - k1

    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend2 = np.average(df_dx)

    k1 = 19
    k2 = 27
    KL = k2 - k1

    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend3 = np.average(df_dx)

    k1 = 24
    k2 = 30
    KL = k2 - k1

    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend4 = np.average(df_dx)

    k1 = 30
    k2 = 35
    KL = k2 - k1

    x_list = []
    y_list = []
    for i in range(k1, k2):
        cndl = data[i]
        y_list.append(cndl)
        x_list.append(i - k1)
    x = np.array(x_list)
    y = np.array(y_list)
    f = interp1d(x, y, fill_value="extrapolate")
    x_fake = np.arange(0, KL, 0.1)
    df_dx = derivative(f, x_fake, dx=1e-6)
    trend5 = np.average(df_dx)
    return trend1, trend2, trend3, trend4, trend5

c = 0
tlist2 = []
trends_list = []
for i in range(35, 100):
    trend1, trend2, trend3, trend4, trend5 = Get_Trends(y[i - 35:i, 0])
    if trend1 >= -0.0015678 and (trend5 >= trend4 or trend5 >= trend3 or trend5 >= trend2) \
            and (trend4 >= trend3 or trend4 >= trend2) and trend4 > 0 and trend5 > 0:
           print(str(i+35) + " -X^2")
           plt.plot(x[i], y[i],"^g")

    elif trend1 <= 0.0015678 and (trend5 <= trend4 or trend5 <= trend3 or trend5 <= trend2) \
            and (trend4 <= trend3 or trend4 <= trend2) and trend4 < 0 and trend5 < 0:
           print(str(i+35) + " X^2")
           plt.plot(x[i], y[i], ".r")

    elif np.abs(trend1-trend2) <= 0.001 and np.abs(trend2-trend3) <= 0.001 and np.abs(trend3-trend4) <= 0.001 and np.abs(trend4-trend5) <= 0.001 and np.abs(trend1-trend5) <= 0.001:
           print(str(i+35) + " y= a")
           plt.plot(x[i], y[i],".b")

    else:
           print(str(i+35) + " No model")
           plt.plot(x[i], y[i], ".y")

plt.plot(x,y)
plt.show()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文