blob: 00ca3cc4239cf4d238477eedfcd570cb516bb912 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
//Chapter 9, Example 9.1
clc
//Initialisation'
C=100*10**3 //capacitance in farad
R=100*10**-6 //resistance in ohm
t=25 //time in seconds
V=20 //voltage
//Calculation
T=C*R //time constant in sec
v=V*(1-exp(-t/T)) //output voltage
//Results
printf("Output Voltage = %.2f V",v)
|