1
table of x, y and z私はあなたに質問があります: xとyのデータを補間してzを返しますこのコードは です。ここで、z値は図のように特定のx値とy値です。table of x, y and z 私はコードを実行するたびに、mynewfancyfun(xnew、ynew)は私にzの正しい値を与えません 任意の提案???補間されたxとyの値のz値を返しますか?
import numpy as np
from scipy import interpolate
from scipy.interpolate import griddata
import itertools
xs = [0.15, 0.35, 0.5, 0.67, 0.8]
ys = [0.01, 0.05, 0.1, 0.2, 0.3]
z = [
0.75, 0.83, 1.00, 0.92, 0.91,
0.75, 0.82, 0.87, 0.88, 0.88,
0.74, 0.81, 0.84, 0.83, 0.83,
0.72, 0.76, 0.77, 0.76, 0.76,
0.72, 0.72, 0.72, 0.72, 0.72
]
points = list(itertools.product(xs,ys)) # create (x,y) pairs
x = [p[0] for p in points]
y = [p[1] for p in points]
tck = interpolate.bisplrep(x, y, z, s=0)
def mynewfancyfun(xnew,ynew):
return interpolate.bisplev(xnew,ynew,tck)
ここで 'mynewfancyfun()'を呼び出しますか? – cosinepenguin
コードの最後に – user8670370