clc; U=100; L=100*0.001; C=50*0.000001; R=20000; beta=R/(2*L); teta=0.000001; omegan=1/(sqrt(L*C)); omegao=sqrt(omegan*omegan-beta*beta); delta=sqrt(beta*beta-omegan*omegan); gama= atan(omegao/beta); a=2*sqrt(L/C); %delta > 0 if (R > a) t=[0:teta:100*teta]; Uct=U*(1-(exp(-beta*t)/delta).*(beta.*sinh(delta*t)+delta.*cosh(delta*t))); it=(U/(L.*delta)).*exp(-beta*t).*sinh(delta*t); Urt=((2.*beta)/(delta)).*U.*exp(-beta*t).*sinh(delta*t); Ult=(U/delta).*exp(-beta*t).*(delta.*cosh(delta*t)-beta.*sinh(delta*t)); elseif (R == a) %delta = 0 t=[0:teta:100*teta]; Uct=U*(1-(1+beta*t)*exp(-beta*t)); it=(U/L)*t*exp(-beta*t); Urt=2*beta*U*t*exp(-beta*t); Ult=U*(1-beta*t)*exp(-beta*t); elseif (R < a) %delta < 0 t=[0:0.05*teta:5*teta]; Uct=U.*(1-(omegan/omegao).*exp(-beta*t).*sin(omegao*t+gama)); it=(U/(omegao.*L)).*exp(-beta*t).*sin(omegao*t); Urt=(((2*beta)/omegao).*U.*exp(-beta*t).*sin(omegao*t)); Ult=-U.*(omegan/omegao).*exp(-beta*t).*sin(omegao*t)-gama; end subplot(4,1,1); plot(t,Uct,'red'); xlabel('t'); ylabel('Uc(t)'); hold on; subplot(4,1,2); plot(t,it,'black'); xlabel('t'); ylabel('i(t)'); subplot(4,1,3); plot(t,Urt,'green'); xlabel('t'); ylabel('Ur(t)'); subplot(4,1,4); plot(t,Ult,'blue'); xlabel('t'); ylabel('Ul(t)');