Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- from matplotlib.animation import FuncAnimation
- fig, ax = plt.subplots()
- xdata, ydata = [], []
- ln, = plt.plot([], [], lw=3)
- a = 0
- b = 0
- def init():
- ax.set_xlim(0, 50*np.pi)
- ax.set_ylim(-20, 20)
- return ln,
- def update(frame):
- xdata.append(a*frame-b*np.sin(frame))
- ydata.append(a-b*np.cos(frame))
- ln.set_data(xdata, ydata)
- return ln,
- a = int(input("daj a"))
- b = int(input("Podaj b "))
- ani = FuncAnimation(fig, update, frames=np.linspace(
- 0, 20*np.pi, 1000),
- init_func=init, interval=5, blit=True, repeat=False)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement