Fix and test interpolation. Issue #43

This commit is contained in:
rowanc1
2014-02-20 10:06:10 -08:00
parent 9f2c976be1
commit 361fb719f0
2 changed files with 26 additions and 16 deletions
+10 -16
View File
@@ -178,19 +178,13 @@ def _interpmat3D(locs, x, y, z):
if __name__ == '__main__':
from SimPEG import *
import matplotlib.pyplot as plt
M = Mesh.TensorMesh([4])
M.vectorCCx
Q = M.getInterpolationMat(np.array([[0],[0.126],[0.127]]),'CC',zerosOutside=True)
print Q.todense()
# locs = np.random.rand(50)*0.8+0.1
# x = np.linspace(0,1,7)
# dense = np.linspace(0,1,200)
# fun = lambda x: np.cos(2*np.pi*x)
# Q = Utils.interpmat(locs, x)
# plt.plot(x, fun(x), 'bs-')
# plt.plot(dense, fun(dense), 'y:')
# plt.plot(locs, Q*fun(x), 'mo')
# plt.plot(locs, fun(locs), 'rx')
# plt.show()
locs = np.random.rand(50)*0.8+0.1
x = np.linspace(0,1,7)
dense = np.linspace(0,1,200)
fun = lambda x: np.cos(2*np.pi*x)
Q = Utils.interpmat(locs, x)
plt.plot(x, fun(x), 'bs-')
plt.plot(dense, fun(dense), 'y:')
plt.plot(locs, Q*fun(x), 'mo')
plt.plot(locs, fun(locs), 'rx')
plt.show()