Collisionman
- 36
- 0
Homework Statement
Numerically determine the period of oscillations for a harmonic oscillator using the Euler-Richardson algorithm. The equation of motion of the harmonic oscillator is described by the following:
\frac{d^{2}}{dt^{2}} = - \omega^{2}_{0}x
The initial conditions are x(t=0)=1 and v(t=0)=0 (i.e., position at time zero = 1 and velocity at time zero = 0) and \omega_{0} = 1.
Homework Equations
Euler-Richardson algorithm:
- a_{n} = \frac{dv}{dt}
- V_{mid}=V_{n}+\frac{a_{n}Δt}{2}
- X_{mid}=X_{n}+\frac{V_{n}Δt}{2}
- a_{mid}=a_{n}+\frac{a_{n}Δt}{2}
- X_{n+1} = X_{n}+{V_{mid}Δt}{2}
- V_{n+1} = V_{n}+{a_{mid}Δt}{2}
Where X, V and a are the position, velocity and acceleration, respectively.
The Attempt at a Solution
I have already written a Matlab programme to numerically solve the differential equation describing the motion using the above algorithm. I used:
\frac{dx}{dt} = 0
\frac{dv}{dt} = 1
However, the only thing is, I don't know how to determine the period numerically from this.