MatLab code for Swinging Spring.


There are two MATLAB files here:
  1. spring.m: The main program for solving the spring equations
  2. roc3d.m: A function to calculate rates of change for the spring equations
You need to save them in two files called "spring.m" and "roc3d.m" (shift-click on the links) and then run "spring" in MATLAB.
The program "spring" is suitable for numerical experimentation, and detailed graphical results can be displayed.
Alternative MATLAB program, displaying the motion in three dimensions:
  1. ss3d.m: This gives prettier pictures, but is less suitable for numerical experimentation than the program "spring.m".
You need to save it in a file called "ss3d.m" and then run "ss3d" in MATLAB.
The program "ss3d", written by Peter Lynch, is adapted from the MATLAB demonstration program "lorenz", written for Expo by Ned Gulley.