Question: The following code currently plots a graph. Alter it using either animation or celluloid in Python to obtain an animation of the same plot. def

The following code currently plots a graph. Alter it using either animation or celluloid in Python to obtain an animation of the same plot.

def dydt_damped_driven(t, y, Q, A, omega_d): theta = y[0] omega = y[1] phi = y[2] result = y * 0 result[0] = omega result[1] = A*np.cos(phi) -(omega/Q + np.sin(theta)) result[2] = omega_d return(result) theta_m = 30.0 Q = 20 A = 0.3 omega_d = 2 time_span = (0,40.0) y0 = np.array([theta_m*np.pi/180.0, 0, 0]) sol = scint.solve_ivp(dydt_damped_driven, time_span, y0, dense_output=True, args = (Q, A, omega_d)) fig,ax = plt.subplots() ax.plot(sol.t, sol.y[0]) ax.scatter(sol.t, sol.y[0]) ax.set_xlabel(r'$t$ [s]') ax.set_ylabel(r'$\theta(t)$ [rad]') plt.show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!