Question: I want to create a code that will satisfy the equation of motion for the pendulum. The pendulum will rotate with the support of a

I want to create a code that will satisfy the equation of motion for the pendulum. The pendulum will rotate with the support of a motor. At first, the pendulum will be at the position of thet_in and it will end at the position of thet_out. Please can you fix the equation of motion so that it will wor as expected:
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
from Pendulum_Animations import animate_pendulum
#Known parameters
g =9.81 #m/s^2
L =1.2 #m
m =20#kg
thet_in =120*(np.pi /180) #starting angle of mechanism (rad)
thet_out =210*(np.pi /180) #Finishing angle (rad)
#Motor constants
T_s =0.69 #Stall Torque, FROM CATALOGUE (Nm)
omega_m =2750*(2* np.pi/60) #No load angular speed (rad/s)
k = T_s / omega_m #motor gradient constant
#Range of gear ratios to try
#G_r =[295.503]
G_r =[320]
#Equation of motion (of a pendulum)
def f(t,z):
theta = z[0]
omega = z[1]
if theta thet_out and omega >0:
T_m = k *(thet_out -theta) #motor torque
else:
T_m =0
dz =[ omega,
(T_m -(g/L)*np.sin(theta))/(L**2)] #+ so will rotate upwards
return dz
 I want to create a code that will satisfy the equation

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!