x y 37 293.79 37.3 293.79 37.6 287.08 37.9 298.63 38.2 310.17 38.5 315.2 38.8 302.35 39.09 315.38 39.39 316.5 39.69 302.72 39.99 315.57 40.29 318.18 40.59 325.62 40.89 322.46 41.19 333.07 41.49 326.93 41.79 348.15 42.09 339.77 42.39 353.74 42.69 358.76 42.98 363.79 43.28 364.35 43.58 367.33 43.88 361.93 44.18 384.08 x y 37 293.79 37.3 293.79 37.6 287.08 37.9 298.63 38.2 310.17 38.5 315.2 38.8 302.35 39.09 315.38 39.39 316.5 39.69 302.72 39.99 315.57 40.29 318.18 40.59 325.62 40.89 322.46 41.19 333.07 41.49 326.93 41.79 348.15 42.09 339.77 42.39 353.74 42.69 358.76 42.98 363.79 43.28 364.35 43.58 367.33 43.88 361.93 44.18 384.08
时间: 2023-08-11 12:05:33 浏览: 95
G201A模组简介.pdf
根据给定的数据点,您可以使用光滑样条曲线来拟合这些数据,以获得更连续和光滑的曲线表示。以下是一种常见的方法,使用样条插值进行拟合:
```python
import numpy as np
from scipy.interpolate import CubicSpline
import matplotlib.pyplot as plt
# 原始数据点
x = np.array([37, 37.3, 37.6, 37.9, 38.2, 38.5, 38.8, 39.09, 39.39, 39.69, 39.99, 40.29, 40.59, 40.89, 41.19, 41.49, 41.79, 42.09, 42.39, 42.69, 42.98, 43.28, 43.58, 43.88, 44.18])
y = np.array([293.79, 293.79, 287.08, 298.63, 310.17, 315.2, 302.35, 315.38, 316.5, 302.72, 315.57, 318.18, 325.62, 322.46, 333.07, 326.93, 348.15, 339.77, 353.74, 358.76, 363.79, 364.35, 367.33, 361.93, 384.08])
# 创建样条插值对象
cs = CubicSpline(x, y)
# 绘制原始数据点
plt.scatter(x, y, color='red', label='Data')
# 绘制样条曲线
x_interp = np.linspace(x.min(), x.max(), 100)
y_interp = cs(x_interp)
plt.plot(x_interp, y_interp, label='Spline')
plt.xlabel('x')
plt.ylabel('y')
plt.legend()
plt.show()
```
运行以上代码,您将得到拟合后的光滑样条曲线图。您可以根据需要调整插值方法和参数,以获得更好的光滑效果。
阅读全文