MatLab code for Swinging Spring.
There are two MATLAB files here:
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 main program for solving the spring equations
A function to calculate rates of change for the spring equations
The program "spring" is suitable for numerical experimentation, and
detailed graphical results can be displayed.
Alternative MATLAB program, displaying the motion in three dimensions:
You need to save it in a file called "ss3d.m" and then run "ss3d" in MATLAB.
This gives prettier pictures, but is less suitable for numerical
experimentation than the program "spring.m".
The program "ss3d", written by Peter Lynch, is adapted from the MATLAB
demonstration program "lorenz", written for Expo by Ned Gulley.