1. 原始数据(x,y)
  2. 先对横坐标x进行扩充数据量,采用linspace。【如下面例子,由7个值扩充到300个】
  3. 采用scipy.interpolate中的spline来对纵坐标数据y进行插值【也由7个扩充到300个】。
  4. 画图
import matplotlib.pyplot as plt
import numpy as np
#数据 T
= np.array([6, 7, 8, 9, 10, 11, 12]) power = np.array([1.53E+03, 5.92E+02, 2.04E+02, 7.24E+01, 2.72E+01, 1.10E+01, 4.70E+00])
#插值
from scipy.interpolate import spline xnew = np.linspace(T.min(),T.max(),300) #300 represents number of points to make between T.min and T.max power_smooth = spline(T,power,xnew) print(xnew.shape) #(300,) print(power_smooth.shape) #(300,)
#画图 plt.plot(xnew,power_smooth) plt.show()

Python画三维图-----插值平滑数据

 二、三维平滑图---插值:

1、数据:

x = [0.1,0.2,……,0.9]   (shape = (9))

y = [0.1,0.2,……,0.9] (shape = (9))

z = 【81个数据】(shape = (81))

生成数据

x = np.linspace(0.1,0.9,9)
y = np.linspace(0.1,0.9,9)
z = np.random.rand(81)
View Code

相关文章:

  • 2021-12-18
  • 2021-11-30
  • 2021-04-05
  • 2022-01-31
  • 2021-07-12
  • 2021-11-29
  • 2021-12-21
猜你喜欢
  • 2022-02-05
  • 2021-12-02
  • 2021-11-24
  • 2021-12-08
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案