Created
February 22, 2020 14:44
-
-
Save Visgean/84cfb40e155870e5c0215481ff03e045 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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