summaryrefslogtreecommitdiff
path: root/1958/CH12/EX12.4/Chapter12_example12_4.sce
blob: b8ea30ced199326b5f597a0b1ca7167e0184b20f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
clc
clear
//Input data
C=10*10^-6//Capicitance in F
R=10*10^3//Resistance in ohms
e=6//Emf of the battery in V

//Calculations
t=C*R//Time constant in s
Qm=(C*e)/10^-6//Maximum charge in micro C
Im=(e/R)*1000//Maximum current in mA

//Output
printf('Time constant of the circuit is %3.1f s \n Maximum charge on the capacitor is %i micro C \n Maximum current in the circuit is %3.1f mA \n Charge at time t is Q(t) = %i(1-exp(-t/%3.1f)) micro C \n Currrent at time t is I(t) = %3.1f exp(-t/%3.1f) mA',t,Qm,Im,Qm,t,Im,t)