teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

追記

2018/08/12 07:51

投稿

tachikoma
tachikoma

スコア3601

answer CHANGED
@@ -1,3 +1,40 @@
1
1
  試せてないので情報ですが、補完が必要です。下記を参考にしてみて下さい。
2
2
 
3
- [Interpolation (scipy.interpolate)](https://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#id1)
3
+ [Interpolation (scipy.interpolate)](https://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#id1)
4
+
5
+ ----
6
+ 上記のコードを少しだけ編集したものを置いておきます。補完アルゴリズムやパラメータは適宜調整する必要があると思います。
7
+ ```Python
8
+ import numpy as np
9
+ import matplotlib.pyplot as plt
10
+
11
+ # 2-d tests - setup scattered data
12
+ x = np.random.rand(100)*4.0-2.0
13
+ y = np.random.rand(100)*4.0-2.0
14
+ z = x*np.exp(-x**2-y**2)
15
+ plt.scatter(x, y, c=z)
16
+ plt.colorbar()
17
+ plt.show()
18
+ ```
19
+ ![scatter](efb2f7920644c21e175cd3ad3eb01899.png)
20
+
21
+ ```python
22
+ # Interpolation: use RBF
23
+ from scipy.interpolate import Rbf
24
+
25
+ ti = np.linspace(-2.0, 2.0, 100)
26
+ XI, YI = np.meshgrid(ti, ti)
27
+ rbf = Rbf(x, y, z, epsilon=2)
28
+ ZI = rbf(XI, YI)
29
+
30
+ # plot the result
31
+ plt.subplot(1, 1, 1)
32
+ plt.pcolor(XI, YI, ZI)
33
+ plt.scatter(x, y, 100, z)
34
+ plt.title('RBF interpolation - multiquadrics')
35
+ plt.xlim(-2, 2)
36
+ plt.ylim(-2, 2)
37
+ plt.colorbar()
38
+ plt.show()
39
+ ```
40
+ ![result](f14b80c4d173fc65d31cf04bd90630a4.png)

1

リンク修正

2018/08/12 07:51

投稿

tachikoma
tachikoma

スコア3601

answer CHANGED
@@ -1,3 +1,3 @@
1
1
  試せてないので情報ですが、補完が必要です。下記を参考にしてみて下さい。
2
2
 
3
- [Interpolation (scipy.interpolate)](https://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#id12)
3
+ [Interpolation (scipy.interpolate)](https://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#id1)