Skip to content

Commit

Permalink
code to reduce frame simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter230655 committed Sep 19, 2024
1 parent 5f36d71 commit 2ba955d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions examples-gallery/plot_pendulum_swing_up_fixed_duration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# %%
"""
Fixed Duration Pendulum Swing Up
================================
Expand Down Expand Up @@ -104,14 +103,7 @@

# %%
# Animate the pendulum swing up.
solution1 = []
for i in range(len(solution)):
if i % 5 == 0:
solution1.append(solution[i])
solution1.append(solution[-1])
solution = solution1
num_nodes = int(len(solution)/3)
time = np.linspace(0.0, duration, num=num_nodes)
time = np.linspace(0, duration, num_nodes)
angle = solution[:num_nodes]

fig = plt.figure()
Expand Down Expand Up @@ -139,7 +131,7 @@ def animate(i):
return line, time_text


ani = animation.FuncAnimation(fig, animate, range(num_nodes),
ani = animation.FuncAnimation(fig, animate, range(0, num_nodes, 5),
interval=int(interval_value*1000*5), blit=True,
init_func=init)

Expand Down

0 comments on commit 2ba955d

Please sign in to comment.