-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path230720regimePermanenteEx2.py
More file actions
56 lines (29 loc) · 1022 Bytes
/
Copy path230720regimePermanenteEx2.py
File metadata and controls
56 lines (29 loc) · 1022 Bytes
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
56
import numpy as np
from matplotlib import pyplot
frequencias = np.logspace(-2,2,3000)
omegas = frequencias*2*np.pi
#resultados = np.zeros(frequencias.shape,dtype=complex)
resultados = np.zeros(frequencias.shape)
fases = np.zeros(frequencias.shape)
phi = 0
C = 1
L = 2
for i,omega in enumerate(omegas):
Yn = np.array([[1+1j*omega*C+1/(1j*omega*L), -1/(1j*omega*L)],
[-1/(1j*omega*L) , 1/(1j*omega*L)+1j*omega*C+1]])
In = np.array([1*np.exp(1j*phi), 0])
E = np.linalg.solve(Yn,In)
resultados[i] = np.abs(E[1])
fases[i] = np.angle(E[1])
pyplot.subplot(1,2,1)
pyplot.plot(frequencias,20*np.log10(resultados))
pyplot.xscale("log")
pyplot.subplot(1,2,2)
pyplot.plot(frequencias,np.degrees(fases))
pyplot.xscale("log")
pyplot.show()
#fig,ax1 = pyplot.subplots()
#ax1.semilogx(frequencias,20*np.log10(resultados))
#ax2 = ax1.twinx()
#ax2.semilogx(frequencias,np.degrees(fases),'r--')
#pyplot.show()