interpol/test.py

14 lines
285 B
Python
Raw Normal View History

2019-07-24 17:19:41 +00:00
import interpol.spline.linear.do as do
import numpy as np
2019-07-24 17:23:49 +00:00
import matplotlib.pyplot as plt
2019-07-24 17:19:41 +00:00
x = np.arange(0, 4, 0.3)
y = np.cos(x)
ip = do.InterPolator(x, y)
2019-07-24 17:23:49 +00:00
x_bar = np.arange(0, 4, 0.01)
plt.plot(x_bar, np.cos(x_bar))
plt.plot(x_bar, [ip.eval_float((i,)) for i in x_bar])
plt.show()