% SMD_noloop.m: Plot displacement of under-damped
% spring-mass-damper system
%
% y0 = initial displacement, inches
% dc = damping coefficient
% fr = natural frequency (omega), radians/sec
% fd = damped frequency (omega_D), radians/sec
% t = time,seconds
% y = displacement, inches
y0 = 3;
dc = 0.10;
fr = 2*pi;
fd = fr*sqrt(1-dc^2);
t = 0:0.05:5;
c = cos(fr*t);
s = sin(fr*t);
e = exp(-dc*fr*t);
y = (y0*c + y0*dc*fr/fd*s).*e;
plot(t,y)
