2019-12-05 07:38:14 +00:00
|
|
|
# coding: utf-8
|
|
|
|
from interpol.spline.linear.do import Interpolator
|
2019-07-24 17:19:41 +00:00
|
|
|
import numpy as np
|
2019-07-24 17:23:49 +00:00
|
|
|
import matplotlib.pyplot as plt
|
2019-12-05 07:38:14 +00:00
|
|
|
X = np.arange(0, 30, 0.3)
|
|
|
|
Y = np.cos(X)
|
|
|
|
i = Interpolator(X, Y)
|
|
|
|
X_bar = np.arange(0, 30, 0.01)
|
|
|
|
Y_bar = np.cos(X_bar)
|
|
|
|
interpolated = np.array([i.eval_float((f,)) for f in X_bar])
|
2019-07-24 17:23:49 +00:00
|
|
|
|
2019-12-05 07:38:14 +00:00
|
|
|
results_half = i.equals_float((0.5,))
|
|
|
|
y_half = [0.5 for x in results_half]
|
|
|
|
plt.plot(X_bar, interpolated, "r-")
|
|
|
|
plt.plot(X_bar, Y_bar, "g-")
|
|
|
|
plt.plot(results_half, y_half, "bo")
|
2019-07-24 17:23:49 +00:00
|
|
|
plt.show()
|