python 三维散点插值 griddata

#三维点插值
#在三维空间中,利用实际点的值推算出网格点的值
import
numpy as np point_grid =np.array([[0.0,0.0,0.0],[0.4,0.4,0.4],[0.8,0.8,0.8],[1.0,1.0,1.0]])#网格点坐标 def func(x, y, z): return x*(1-x)*np.cos(4*np.pi*x) * (np.sin(4*np.pi*y**2)**2)*z points = np.random.rand(10, 3)#实际点坐标 values = func(points[:,0], points[:,1],points[:,2])#实际点的值 from scipy.interpolate import griddata grid_z0 = griddata(points, values, point_grid, method='nearest')#插值计算,计算出网格点的值

 

posted @ 2017-11-15 14:17  秋华  阅读(27164)  评论(0编辑  收藏  举报