Using Euler-Cromer to find the motion of a simple pendulum?

1 次查看(过去 30 天)
My professor wants us to find the number of periods a simple, meter-long pendulum will have in a day if given an initial angle of 50 degrees using the Euler-Cromer method. My problem is that I can't come up with al the equations I need.
I know that I need: dθ/dt = f(t, ω) and dω/dt = g(t, θ).
I managed to get dω/dt = -9.8*sin(θ). I can't figure out what dθ/dt should be, though. Once I have that, I understand how to use for loops to find θ and ω for time steps and if statements to fin the number of periods throughout the day (even if it is inefficient), I just can't seem to get started. Can anybody give me some help as to what dθ/dt is? Remember, the starting angle is 50 degrees, so the small angle approximation cannot be used.

回答(1 个)

Matt Kindig
Matt Kindig 2012-4-4
Can you use the ODE solvers built-in to Matlab (something like 'ode45')? If so, that would be the easiest way, and would avoid looping completely.
If the objective of the assignment is to implement your own ODE solver, then I would look up the definition for Runge-Kutta integration on Wikipedia or similar.
By the way, d(theta)/dt is just w (omega).
  2 个评论
Rachel
Rachel 2012-4-4
We are supposed to implement our own ODE solver, and I know about the Runge-Kutta method, but we are told explicitly in the problem to use the Euler-Cromer.
I tried using dθ/dt(i) = ω(i), but I end up with a pendulum that swings in circles, not an arc of 100 degrees total.
Matt Kindig
Matt Kindig 2012-4-4
Ah, my apologies. I realized I overlooked that you specified the Euler-Cromer method. Can you post your code for us to look over?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by