-
Notifications
You must be signed in to change notification settings - Fork 4
/
ECN_291.py
55 lines (43 loc) · 889 Bytes
/
ECN_291.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
When i code in python..it's just like a pro
"""
import numpy as np
import matplotlib.pyplot as plt
"""
Everything is in SI units
"""
"""
Vconst = 5000 * Is * exp(Vdc/Vt)
Vout Vcc - Vconst * exp(Vac/Vt)
"""
Vconst = 7
Vcc = 15
Vt = 0.026
t = np.arange(0, 20, 0.2)
Vac = (0.005 * np.sin(t))/0.026
Vac1 = Vconst * np.exp(Vac)
Vfinal = 15 - Vac1
"""
To get DC offset of the Vout
VoutDC = 15 - Vconst = 8
To just get AC signal of the signal
Vfinal - VoutDC
Vamp is the max of the amplitude taken which is below
x Axis in this case
"""
VoutDC = 8
Vamp = 1.4843038
"""
Multiplied by -1 to reverse the graph
"""
plt.plot(t, -1 * (Vfinal - VoutDC)/Vamp, 'r')
"""
For general plotting of sin function Normalized
"""
plt.plot(t, np.sin(t), 'b')
plt.title('Bjt Equation')
plt.xlabel('Time')
plt.ylabel('Amplitude')
plt.grid(True, which='both')
plt.axhline(y=0, color='g')
plt.show()