Skip to content

Instantly share code, notes, and snippets.

@appplemac
Last active December 14, 2015 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save appplemac/5003736 to your computer and use it in GitHub Desktop.
Save appplemac/5003736 to your computer and use it in GitHub Desktop.
CI, condensator charge calculus
C = 100e-12
R = 10e3
T = 10e-9
const = Math::E**(-T/(R*C))
vc = 5*(1-const)
vc1 = vc * const
1000000.times do
vc = 5 - ((5-vc1)*const)
vc1 = vc*const
end
print "Maximum: ", vc, "\n"
print "Minimum: ", vc1, "\n"
# => Maximum: 2.51249989583436
# => Minimum: 2.48750010416561
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment