import numpy as np
import matplotlib.pyplot as plt
import math
from scipy.interpolate import make_interp_spline #平滑曲线用的函数
plt.axis([0, 130,-16, 16])
xss=np.array([0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130])
ys=np.array([-1.56699, -1.55284, -1.51299, -1.44526, -1.34541, -1.20726, -1.02088, -0.775333, -0.463055,
-0.0576436, 0.475682, 1.15845, 2.00164, 2.99478, 4.13066, 5.38871, 6.73956, 8.10639, 9.43044,
10.6792, 11.8363, 12.8766, 13.7775, 14.5165, 15.0723, 15.4162, 15.5427])
plt.ion()
for k in range(20):
for i in range(101):
A=math.sin(i*math.pi/50)
yss=A*ys
x_smooth = np.linspace(xss.min(), xss.max(), 300)
y_smooth = make_interp_spline(xss, yss)(x_smooth)
plt.cla()
plt.plot(x_smooth, y_smooth,linewidth = '2', color= '#FF0000')
plt.axis([0, 130,-16, 16])
plt.show()
plt.pause(0.005)
if i==0 and k==0:input()