How to find frequency & period of pendulum in C

In summary, the author is trying to find the period of oscillation for a non-linear pendulum with unrestricted amplitudes. He found a website that calculates the period.
  • #1
E=F_flat
3
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
  • #2
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.
 
  • #3
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.
 
  • #4
Your initial value of theta is about 5.7 degrees, which should simulate a pendulum for small amplitudes.
 
  • #5
And when θ is "small", sin(θ) ≈ θ. That approximation will turn your nonlinear system into a linear one.
 
  • #6
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?
 

1. How do I calculate the frequency of a pendulum in C?

The frequency of a pendulum in C can be calculated using the formula f = 1/T, where T is the period of the pendulum. In C, the gravitational acceleration (g) is approximately 9.8 m/s^2, so the period can also be calculated using the formula T = 2π√(L/g), where L is the length of the pendulum.

2. What is the period of a pendulum in C?

The period of a pendulum in C can be calculated using the formula T = 2π√(L/g), where L is the length of the pendulum and g is the gravitational acceleration (approximately 9.8 m/s^2 in C). The period is the time it takes for the pendulum to complete one full swing from left to right and back again.

3. How does the length of a pendulum affect its frequency in C?

The length of a pendulum has a direct effect on its frequency in C. According to the formula f = 1/T, the frequency is inversely proportional to the period. This means that as the length of the pendulum increases, the period also increases, resulting in a lower frequency. Similarly, a shorter pendulum will have a higher frequency.

4. Can the mass of a pendulum affect its frequency and period in C?

Yes, the mass of a pendulum can affect its frequency and period in C. However, this effect is minimal and can be ignored for most practical purposes. The formulas for calculating frequency and period do not include the mass of the pendulum, but they do assume that the mass is evenly distributed along the length of the pendulum.

5. How does the gravitational acceleration in C affect the frequency and period of a pendulum?

The gravitational acceleration in C has a direct effect on the frequency and period of a pendulum. As mentioned earlier, the formula T = 2π√(L/g) includes the gravitational acceleration (g). This means that as the gravitational acceleration increases, the period decreases, resulting in a higher frequency. However, since the gravitational acceleration is constant in C, this effect is minimal and can be ignored for most practical purposes.

Similar threads

  • Introductory Physics Homework Help
Replies
9
Views
700
  • Introductory Physics Homework Help
Replies
14
Views
483
  • Mechanical Engineering
Replies
19
Views
1K
  • Introductory Physics Homework Help
Replies
27
Views
729
Replies
8
Views
1K
  • Classical Physics
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
3K
  • Introductory Physics Homework Help
Replies
26
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
16
Views
1K
Back
Top