jalovi poskusi stabilizirat racun prenosne konstante
parent
428537aac3
commit
3f7a3e7945
12
s2eps.py
12
s2eps.py
|
@ -28,24 +28,28 @@ def s_to_eps(s, L):
|
||||||
G = X + np.sqrt(X**2 - 1)
|
G = X + np.sqrt(X**2 - 1)
|
||||||
Gm = X - np.sqrt(X**2 - 1)
|
Gm = X - np.sqrt(X**2 - 1)
|
||||||
G[np.abs(G) > 1] = Gm[np.abs(G) > 1]
|
G[np.abs(G) > 1] = Gm[np.abs(G) > 1]
|
||||||
test_plot(f,G)
|
|
||||||
P = (s11 + s21 - G)/(1-(s11+s21)*G)
|
P = (s11 + s21 - G)/(1-(s11+s21)*G)
|
||||||
Lambda2 = - (1/2/np.pi/L * np.log(1/P))**2 #izmisli resitev za korene kompleksnega logaritma
|
Lambda2 = - (1/2/np.pi/L * np.log(1/P))**2 #izmisli resitev za korene kompleksnega logaritma
|
||||||
# argument korena mora biti 2*pi*n, kjer je n=L/lambda_g
|
# argument korena mora biti 2*pi*n, kjer je n=L/lambda_g
|
||||||
test_plot(f,np.log(P))
|
|
||||||
|
|
||||||
return measured_group_delay(f,P)
|
return measured_group_delay(f,P)
|
||||||
|
|
||||||
def measured_group_delay(f, P):
|
def measured_group_delay(f, P):
|
||||||
phase = np.unwrap(np.angle(P))
|
phase = np.unwrap(np.angle(P))
|
||||||
test_plot(f,phase)
|
test_plot(f,phase)
|
||||||
|
# zgladim fazo s polinomsko aproksimacijo druge stopnje
|
||||||
|
#ph = np.polyfit(f,phase,2)
|
||||||
|
#print(ph)
|
||||||
|
#faza = ph[2]+ph[1]*f+ph[0]*f**2
|
||||||
|
#test_plot(f,faza-phase)
|
||||||
return -np.diff(phase)/np.diff(f)/2/np.pi
|
return -np.diff(phase)/np.diff(f)/2/np.pi
|
||||||
|
|
||||||
def test_plot(x,y):
|
def test_plot(x,*args):
|
||||||
|
for y in args:
|
||||||
plt.plot(x,y)
|
plt.plot(x,y)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
a=s2p_to_narray('teflon.s2p')
|
a=s2p_to_narray('20.s2p')
|
||||||
b = narray_to_s(a)
|
b = narray_to_s(a)
|
||||||
locals().update(b)
|
locals().update(b)
|
||||||
c= s_to_eps(b,6e-2)
|
c= s_to_eps(b,6e-2)
|
||||||
|
|
Loading…
Reference in New Issue