Skip to content

Instantly share code, notes, and snippets.

@Visgean
Created February 22, 2020 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Visgean/84cfb40e155870e5c0215481ff03e045 to your computer and use it in GitHub Desktop.
Save Visgean/84cfb40e155870e5c0215481ff03e045 to your computer and use it in GitHub Desktop.
from scipy.interpolate import interp1d
import numpy as np
import matplotlib.pyplot as plt
a = 0
b = 10
linear_gains = (b - a) / 16
li = lambda x: a + linear_gains * x
xs = [0, 6, 8, 10, 16]
ys = [a, li(2), li(8), li(14), b]
cubic = interp1d(xs, ys, kind='cubic')
space = np.linspace(start=0, stop=16, num=16)
plt.plot(space, cubic(space))
plt.scatter(xs, ys)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment