home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / demo / ode.zoo / oscillat.ode < prev    next >
Text File  |  1990-01-04  |  514b  |  28 lines

  1. # OSCILLAT.ODE
  2. # A driven, damped oscillator
  3. #
  4. # Select 5th order Runge-Kutta, fixed stepsize
  5. $m -5
  6. # Solve to time=100
  7. $t 100
  8. position = 1
  9.  
  10. # Initial values
  11. velocity = 0
  12. time     = 0
  13.  
  14. # Try different amounts of damping
  15. damping  = 0.5
  16.  
  17. # Omega is the natural frequency
  18. omega    = 1
  19. # Driving frequency
  20. drivefreq= 1
  21. # Drive amplitude
  22. amplitude= 1
  23.  
  24. # Differential equations
  25. time'     = 1
  26. position' = velocity
  27. velocity' = -omega*position - damping*velocity + amplitude*cos(drivefreq*time)
  28.