jalovi poskusi stabilizirat racun prenosne konstante

master
Andrej 2021-05-11 12:56:38 +02:00
parent 428537aac3
commit 3f7a3e7945
1 changed files with 9 additions and 5 deletions

View File

@ -28,24 +28,28 @@ def s_to_eps(s, L):
G = X + np.sqrt(X**2 - 1)
Gm = X - np.sqrt(X**2 - 1)
G[np.abs(G) > 1] = Gm[np.abs(G) > 1]
test_plot(f,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
# 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)
def measured_group_delay(f, P):
phase = np.unwrap(np.angle(P))
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
def test_plot(x,y):
plt.plot(x,y)
def test_plot(x,*args):
for y in args:
plt.plot(x,y)
plt.show()
a=s2p_to_narray('teflon.s2p')
a=s2p_to_narray('20.s2p')
b = narray_to_s(a)
locals().update(b)
c= s_to_eps(b,6e-2)