D2L | Wiley Plus Student Resources | UA Math

MATLAB GUI: Mass-Spring System



Description

This GUI simulates the solution to the ordinary differential equation m y'' + c y' + k y = F(t), describing the response of a one-dimensional mass spring system with forcing function F(t) given by (i) a unit square wave or (ii) a Dirac delta function (e.g. "hammerblow'). Without loss of generality, m is set to 1.

The GUI allows the user

  • To choose the damping coefficient c/m and square natural frequency k/m of the system;
  • To change the height N (and, consequently, the width 1/N) of the unit forcing function, or to choose the forcing function to be an "infinitely tall" unit forcing function, i.e. a Dirac delta function;
  • To zoom in on the immediate response of the system, in order to compare the case where the forcing function is given by a large but finite unit square wave (e.g. with N = 20) with the case where the forcing function is given by the Dirac delta function.
In each case, the program graphs the forcing function and the solution of the spring-mass system on the same axes.



How to use the GUI

  • Use the sliders to change the values of the parameters c/m, k/m, or N.
  • Click on the button labeled Infinite to change the forcing to a delta function. Click on Finite to come back to a square wave forcing.
  • Click on Close up centered at (x,y) = (1,0) to zoom in near the origin.


Download

Download (right click on each link below) the following files into a directory. Set the MATLAB path to that directory and type Mass_Spring_System at the MATLAB prompt. Type help Mass_Spring_System at the MATLAB prompt if you need to be reminded of how to use the GUI.


© GUI developed by Benjamin Dyhr, Spring 2007.
© Joceline Lega, 2007