function [va,v,Error]=CapacitorSec3(vs, R, C,tf)
 dt=0.001;
 va=0;
  for i=1: round(tf/dt)
    va=va+(vs-va)/(R*C)*dt;
  end
  v=vs*(1-exp(-tf/(R*C)));
  Error=v-va;
end