File:Charge et décharge d'un condensateur.svg
Summary
Description |
Français : Charge et décharge d'un condensateur. Tracé avec Matplotlib. Code utilisé: python. |
Date | |
Source | Own work |
Author | Savant-fou |
SVG development | |
Source code | Python code# -*- coding: utf-8 -*-
import math
from numpy import arange
import numpy as numpy
from matplotlib.pyplot import plot, show
import matplotlib.pyplot as plt
t = arange(0.0, 12.0, 0.01)
s = []
for a in t[0:numpy.size(t)/2]:
s.append(1-numpy.exp(-a))
for b in t[numpy.size(t)/2+0.01:1200]:
s.append(numpy.exp(-b+6))
e = [0]
i = 1
while i != 6/0.01:
e.append(1)
i += 1
while i != 12/0.01:
e.append(0)
i+=1
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.set_ylabel('Tension (volts)')
ax1.plot(t,e,"b--")
ax2 = fig.add_subplot(111)
ax2.set_xlabel('Temps (secondes)')
ax2.plot(t,s,"r")
plt.axis([0,12,0,1.1])
plt.grid(True)
plt.legend((u"Échelon de tension","Tension aux bornes du condensateur"),loc="lower right")
plt.savefig('charge_decharge_condensateur.svg' ,transparent=False)
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.