使用np.polyfit拟合数据系列,并使用np.polyval评估其绘制的曲线,如下所示:
。如何在曲线上的某一点计算切线,并如何以系列中的x和y值沿曲线动画一系列切线?感谢James Phillips的解决方案,下面绘制了多项式曲线上的切线:
。
![enter image description here](https://istack.dev59.com/e6y1u.webp)
![Tangent line on a polynomial curve](https://istack.dev59.com/Torna.webp)
x y
0 21.05
1 21.21
2 20.76
3 20.34
4 20.27
5 20.78
6 20.60
7 20.55
8 19.95
9 19.23
10 19.64
11 19.92
12 19.91
13 19.56
14 19.39
15 19.31
16 19.35
17 18.97
18 18.69
19 19.00
20 19.15
21 19.08
22 18.97
23 19.26
24 19.52
25 19.56
26 19.28
27 19.47
28 19.85
29 19.77