function [xt,Env] = SDOF_VLA(t,wn,xo,vo,xi)
% Resolucion de la ecuacion para vibracion libre con amortiguamiento
%   Los datos requeridos son: [xt] = SDOF_VLA(t,wn,xo,vo,xi)
%   [t] → intervalo de tiempo
%   wn → frecuencia natural del sistema
%   xo → desplazamiento inicial
%   vo → velocidad inicial
%   xi → ratio de amortiguamiento

    wd=wn*(1-xi^2)^0.5;

if xi<1.00 
    a = (exp(-xi*wn*t));
    b = (xo*cos(wd*t)+((vo+xo*xi*wn)/wd)*sin(wd*t));
    xt=a.*b;
end

if xi > 1.00
    a=(exp(-xi*wn*t))/(2*wn*(xi^2-1));
    b=exp(wn*t*(xi^2-1)^0.5);
    c=exp(-wn*t*(xi^2-1)^0.5);
    d=vo+xo*wn*(xi+(xi^2-1)^0.5);
    e=-vo-xo*wn*(xi-(xi^2-1)^0.5);
    xt=a.*(b*d+c*e);
end

if xi==1.00
    xt=(exp(-wn*t)).*(xo+(vo+xo*wn)*t);
end

% Calculo de la envolvente
rho=((xo)^2+((vo+xi*wn*xo)/(wd))^2)^0.5;
Env=(exp(-xi*wn*t))*rho;

end