disp('by kvl') disp('Ldi/dt+Ri+1/c*integ(i)=V') disp('given') disp('V=1,R=3,L=1,C=0.5') disp('Replacing di/dt with s and (di/dt)^2 with s^2') disp('we get') disp('s^2+3s+2') s=poly(0,'s') p=s^2+3*s+2 r=roots(p) disp(r) disp('therefore the current in general form is') disp('i(t)=k1exp(-t)+k2exp(-2t)') //k1 and k2 are constants and are evaluated by knowing inital conditions disp('initial conditions are') disp('di/dt at 0+ is V/L=1') disp('i(t) at 0+ is 0') disp('on solving we get k1=1,k2=-1') t=0:0.1:2 i=exp(-t)-exp(-2*t) subplot(221) xtitle("exp(-t)") plot2d(exp(-t)) subplot(222) xtitle("exp(-2t)") plot2d(exp(-2*t)) subplot(223) xtitle("i") plot2d(i)