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 thetin and it will end at the position of thetout. 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 solveivp
from PendulumAnimations import animatependulum
#Known parameters
g #ms
L #m
m #kg
thetin nppi #starting angle of mechanism rad
thetout nppi #Finishing angle rad
#Motor constants
Ts #Stall Torque, FROM CATALOGUE Nm
omegam nppi #No load angular speed rads
k Ts omegam #motor gradient constant
#Range of gear ratios to try
#Gr
Gr
#Equation of motion of a pendulum
def ftz:
theta z
omega z
if theta thetout and omega :
Tm k thetout theta #motor torque
else:
Tm
dz omega,
Tm gLnpsinthetaL # so will rotate upwards
return dz
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
