Skip to content

Commit

Permalink
Made the changes you just told me to do, except the linear initial guess
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter230655 committed Jun 30, 2024
1 parent 5cb1839 commit 2413380
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions examples-gallery/plot_two_link_pendulum_on_a_cart.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# %%
"""
=========================
Upright a double pendulum
==========================
Expand Down Expand Up @@ -95,7 +94,7 @@
specified_symbols = (F,)

target_angle = np.pi /2.0
num_nodes = 250
num_nodes = 400

duration = (num_nodes - 1) * h
interval_value = h
Expand Down Expand Up @@ -163,7 +162,7 @@ def obj_grad(free):
bounds=bounds)

# Initial guess.
WERT = (0., 0., 0., 0.0, 0.0, 0.0, 80.0)
WERT = (0., 0., 0., 0.0, 0.0, 0.0, 0.0)
initial_guess = np.array([wert for wert in WERT for _ in range(num_nodes)] + [0.01])
# allows to change the number of iterations.
# standard is 3000
Expand Down Expand Up @@ -263,14 +262,14 @@ def animate(i):
return line1, line2,

anim = animation.FuncAnimation(fig, animate, frames=num_nodes,
interval=40,
interval=solution[-1]*1000.0,
blit=False)

## %%
# A frame from the animation.
animate_pendulum(times, P1_x, P1_y, P2_x, P2_y)
fig, ax, line1, line2, recht = animate_pendulum(times, P1_x, P1_y, P2_x, P2_y)

# sphinx_gallery_thumbnail_number = 5
animate(150)
animate(100)

plt.show()

0 comments on commit 2413380

Please sign in to comment.