Solving the Harmonic Oscillator Equation
Total Page:16
File Type:pdf, Size:1020Kb
Solving the Harmonic Oscillator Equation Morgan Root NCSU Department of Math Spring-Mass System Consider a mass attached to a wall by means of a spring. Define y=0 to be the equilibrium position of the block. y(t) will be a measure of the displacement from this equilibrium at a given time. Take dy(0) y(0) = y0 and dt = v0. Basic Physical Laws Newton’s Second Law of motion states tells us that the acceleration of an object due to an applied force is in the direction of the force and inversely proportional to the mass being moved. This can be stated in the familiar form: Fnet = ma In the one dimensional case this can be written as: Fnet = m&y& Relevant Forces Hooke’s Law (k is FH = −ky called Hooke’s constant) Friction is a force that FF = −cy& opposes motion. We assume a friction proportional to velocity. Harmonic Oscillator Assuming there are no other forces acting on the system we have what is known as a Harmonic Oscillator or also known as the Spring-Mass- Dashpot. Fnet = FH + FF or m&y&(t) = −ky(t) − cy&(t) Solving the Simple Harmonic System m&y&(t) + cy&(t) + ky(t) = 0 If there is no friction, c=0, then we have an “Undamped System”, or a Simple Harmonic Oscillator. We will solve this first. m&y&(t) + ky(t) = 0 Simple Harmonic Oscillator k Notice that we can take K = m and look at the system: &y&(t) = −Ky(t) We know at least two functions that will solve this equation. y(t) = sin( Kt) and y(t) = cos( Kt) Simple Harmonic Oscillator The general solution is a linear combination of sin and cos. y(t) = Acos(ω0t) + Bsin(ω0t) k Where ω0 = m . Simple Harmonic Oscillator We can rewrite the solution as y(t) = Αsin(ω0t +φ) k where ω0 = m and 2 2 −1 Α = y + (v0 ) and φ = tan y0ω0 0 ω0 ()v0 Visualizing the System Undamped SHO 2 m=2 c=0 1.5 k=3 1 0.5 t n e m e c 0 a l p s Di -0.5 -1 -1.5 -2 0 2 4 6 8 10 12 14 16 18 20 Time Alternate Method: The Characteristic Equation k Again we take ω0 = m and look at the system: 2 &y&(t) +ω0 y(t) = 0 Assume an exponential solution, y(t) = ert . rt 2 rt ⇒ y&(t) = re and &y&(t) = r e Subbing this into the equation we have: 2 rt 2 rt r e +ω0 e = 0 Alternate Method: The Characteristic Equation To have a solution we require that 2 2 r = −ω0 ⇒ r = ±iω0 Thus we have two solutions y(t) = eiω0 and y(t) = e−iω0 Alternate Method: The Characteristic Equation As before, any linear combination of solutions is a solution, giving the general solution: y(t) = A*eiω0t + B*e−iω0t Euler’s Identity Recall that we have a iω0t relationship between e e = cos(ω0t)+ isin(ω0t) and sine and cosine, and known as the Euler −iω0t identity. e = cos()ω0t − isin()ω0t Thus our two solutions are equivalent Rewrite the solution We now have two solutions to : m&y&(t)+ ky(t) = 0 One with complex exponentials y(t) = A*eiω0t + A*e−iω0t and one with sine y(t) = Αsin(ω0t +φ) Damped Systems If friction is not zero then we cannot used the same solution. Again, we find the characteristic equation. Assume y(t) = ert then, rt 2 rt y&(t) = re and &y&(t) = r e Damped Systems Remember that we are now looking for a solution to : &y&(t) + Cy&(t) + Ky(t) = 0 Subbing in &y&, y& and y we have, r 2ert + Crert + Kert = 0 Which can only work if r 2 + Cr + K = 0 Damped Systems This gives us that : 2 2 −C± C −4ω0 k r = 2 where ω0 = m 2 2 Let α = C − 4ω0 We have three options 1. α > 0 overdamped 2. α = 0 critically damped 3. α < 0 underdamped Underdamped Systems The case that we are interested in is the 2 2 C − 4ω0 < 0 underdamped system. The solution is −C+i α −C−i α y(t) = Ae 2 + Be 2 or y(t) = e−C / 2 (Acos(ωt) + Bsin(ωt)), 1 2 4mk−c2 ω = 2 4K − C = 2m Underdamped Systems We can rewrite this in a more intuitive form, −c t y(t) = Αe 2m sin(ωt +φ) 4mk − c2 Where ω = , 2m 2 2 −1 A Α = A + B , φ = tan ( B), c v0 + 2m y0 A = y0 and B = ω Visualizing Underdamped Systems Underdamped System 2 1.5 m=2 c=0.5 k=3 1 t 0.5 n e m ce a l sp i 0 D -0.5 -1 -1.5 0 2 4 6 8 10 12 14 16 18 20 Time Visualizing Underdamped Systems Underdamped Harmonic Oscillator 2 m=2 1.5 y(t)=Ae-(c/2m)t c=0.5 k=3 1 0.5 t n e m e c 0 a l p s Di -0.5 -1 -(c/2m)t -1.5 y(t)=-Ae -2 0 2 4 6 8 10 12 14 16 18 20 Time Visualizing Underdamped Systems Another Underdamped System 2 m=2 c=2 1.5 k=3 1 t n e m ce a l sp i D 0.5 0 -0.5 0 2 4 6 8 10 12 14 16 18 20 Time Visualizing Underdamped Systems Underdamped Harmonic Oscillator 2.5 2 m=2 c=2 1.5 k=3 y(t)=Ae-(c/2m)t 1 0.5 t n e m ce 0 a l sp i D -0.5 -1 y(t)=-Ae-(c/2m)t -1.5 -2 -2.5 0 2 4 6 8 10 12 14 16 18 20 Time Will this work for the beam? The beam seems to fit the harmonic conditions. Force is zero when displacement is zero Restoring force increases with displacement Vibration appears periodic The key assumptions are Restoring force is linear in displacement Friction is linear in velocity Writing as a First Order System Matlab does not work with second order equations However, we can always rewrite a second order ODE as a system of first order equations We can then have Matlab find a numerical solution to this system Writing as a First Order System Given this second order ODE &y&(t) + Cy&(t) + Ky(t) = 0, with y(0) = y0 and y&(0) = v0 We can let z1(t) = y(t) and z2 (t) = y&(t). Clearly, z&1(t) = z2 (t) and z&2 (t) = −Kz1(t) − Cz2 (t) Writing as a First Order System Now we can rewrite the equation in matrix - vector form ⎡z&1 ⎤ ⎡ 0 1 ⎤⎡z1 ⎤ ⎢ ⎥(t) = ⎢ ⎥⎢ ⎥(t) ⎣z&2 ⎦ ⎣− K − C⎦⎣z2 ⎦ or ⎡ 0 1 ⎤ z(t) = Az(t) where A = ⎢ ⎥ ⎣− K − C⎦ with ⎡y0 ⎤ z(0) = ⎢ ⎥ ⎣v0 ⎦ This is now in a form that will work in Matlab. Constants Are Not Independent Notice that in all our solutions we never have c, m, or k alone. We always have c/m or k/m. The solution for y(t) given (m,c,k) is the same as y(t) given (αm, αc, αk). Very important for the inverse problem Summary We can used Matlab to generate solutions to the harmonic oscillator At first glance, it seems reasonable to model a vibrating beam We don’t know the values of m, c, or k Need the inverse problem.