利用线性函数做插值 每一段的线性函数: #Program 0.6 Linear Interploation import numpy as np import matplotlib.pyplot as plt #分段线性插值闭包 def get_line(xn, yn): def line(x): index = -1 #找出x所在的区间 for i in range(1, len(xn)): if x <= xn[i]: index = i-1 break else: i += 1 if in