Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started