%Lecture11b

R=2
L=10^-3
C=10^-5


S=roots([1 R/L 1/(L*C)])

sigma=real(S(1))
wd=abs(imag(S(1)))

Vi=10;
Vf=20;

t=[0:0.0001:0.01];

V=exp(sigma*t).*((Vi-Vf)*cos(wd*t)-sigma/wd*(Vi-Vf)*sin(wd*t))+Vf;

plot(t,V)