Source Code

http://www.mathworks.com/matlabcentral/fileexchange/31246-spring-mass-damper-system-behavior-analysis/content/SMDode_linear.m