赞
踩
求t=16时,速度v的值
#线性插值法(一次线性插值)
x = 16
#16在15与20之间,所以,只需要两组数据
x0 = 15
y0 = 362.78
x1 = 20
y1 = 517.35
P = y0 + (y1-y0)/(x1-x0)*(x-x0)
print(P)
结果:
393.69399999999996
#线性插值法(一次线性插值) x_list = [0, 10, 15, 20, 22.5, 30] y_list = [0, 227.04, 362.78, 517.35, 602.97, 901.67] x0, y0, x1, y1 = 0, 0, 0, 0 x = 16 for i in range(len(x_list)): if x < x_list[i]: x0 = x_list[i-1] y0 = y_list[i-1] x1 = x_list[i] y1 = y_list[i] break else: pass #16在15与20之间,所以,只需要两组数据 P = y0 + (y1-y0)/(x1-x0)*(x-x0) print(P)
结果:
393.69399999999996
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。