C=1e-7;
R=1050;
tau=R*C;
x1=0:0.00002:0.0005;
x2=0.0005:0.00002:0.001;
y1=0.8*(1-exp(-x1/tau));
y2=0.8*(exp(-(x2-0.0005)/tau))-(0.8-0.8*(1-exp(-0.0005/tau))); x=[x1,x2];
y=[y1,y2];
plot(x,y)
hold on
a1=0:0.00002:0.0005;
a2=0.0005:0.00002:0.001;
S=5000;
tav=S*C;
b1=0.8*(1-exp(-a1/tav));
b2=0.8*(exp(-(a2-0.0005)/tav))-(0.8-0.8*(1-exp(-0.0005/tav))); a=[a1,a2];
b=[b1,b2];
plot(a,b,'r')
hold on
c1=0:0.00002:0.0005;
c2=0.0005:0.00002:0.001;
T=7000;
taw=T*C;
d1=0.8*(1-exp(-c1/taw));
d2=0.8*(exp(-(c2-0.0005)/taw))-(0.8-0.8*(1-exp(-0.0005/taw))); c=[c1,c2];
d=[d1,d2];
>> plot(c,d,'g')
>> grid on
>> axis([0 0.001 0 0.8])
>> xlabel('Time, s')
>> ylabel('The voltage of the capacitor, V')
>> title('Simulation circuit transient of RC')
>> text(0.0004,0.76,'R=1050')
>> text(0.0004,0.42,'R=5000')
>> text(0.0004,0.33,'R=7000')