% Unit 2 (MATLAB Course @ UAM)
% (c) Alexander Knebe

function [x] = dho_position(k,m,c,x0,t)

gamma = c./(2.*m);
w0    = sqrt(k./m);
zeta  = c./(2.*sqrt(m.*k));
phi   = acos(sqrt(1-zeta.^2));

x = x0./(sqrt(1-zeta.^2)).*exp(-gamma.*t).*cos(w0.*sqrt(1-zeta.^2).*t-phi);



end