Finding frequency and period of non-linear pendulum in C simulation

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 4K views
E=F_flat
Messages
3
Reaction score
0
1. The problem statement

Hi everyone, I'm currently working on an assignment that involves modelling a non-linear pendulum in C. I have to investigate the dynamics of a simple non-linear pendulum all the way up to a chaotic damped, driven situation. However, I'm completely baffled as to how to find the frequency of oscillation and period through my simulation (for large amplitudes). Do I simply use a counting method which involves storing the times at which the pendulum angle (or angular velocity) change sign, or is there some other more efficient method? I'm not asking for code, I just want some guidance as to what course of action to take.

Homework Equations



For the moment, I'm modelling the simple non-linear pendulum with equation:

[itex]\frac{d^{2}θ}{dt^{2}}[/itex] = -[itex]\frac{g}{l}[/itex]sinθMy Runge-Kutta code is based on the following equations:

[itex]\frac{dθ}{dt}[/itex] = ω

[itex]\frac{dω}{dt}[/itex] = -[itex]\frac{g}{l}[/itex]sinθ

ω = angular velocity
g = acceleration due to gravity
l = length of pendulum
θ = angle of pendulum in relation to the vertical
 
Last edited:
Physics news on Phys.org
What initial conditions are you using for your RK method?

The period of oscillation would be the interval from when the pendulum starts at its initial deflection theta and returns to the same angle.
 
SteamKing said:
What initial conditions are you using for your RK method?

For my RK method I initialised the variables as follows:

θ = 0.1
ω = 0
dt = 0.04 (time step)

However, I have to investigate the dynamics of the pendulum at progressively larger amplitudes.
 
Your initial value of theta is about 5.7 degrees, which should simulate a pendulum for small amplitudes.
 
And when θ is "small", sin(θ) ≈ θ. That approximation will turn your nonlinear system into a linear one.
 
Thanks for responding. I only entered those initial values to test that my RK method was working. However, I will have to enter large values of θ, and the small amplitude approximation will no longer be accurate.

I happened to come across the following website:
http://webphysics.davidson.edu/alumni/BeKinneman/pendulum/report.htm

This report derives the following equation for period of a non-linear pendulum with unrestricted amplitudes:

T = 4[itex]\sqrt{\frac{l}{g}}[/itex][itex]\int^{1}_{0}\frac{1}{\sqrt{ { <1-z^{2}> . [ 1 - (k)^{2}z^{2}] }}}[/itex]dz

I was thinking of adapting this formula into my C-program. You can't perform integrals on C, so I would have to perform a summation between max amplitude and zero amplitude. Am I on the right lines, or am I talking complete rubbish?