From 3f7a3e7945ed41222e86f47dcc3d6217dc91c9c5 Mon Sep 17 00:00:00 2001 From: Andrej Date: Tue, 11 May 2021 12:56:38 +0200 Subject: [PATCH] jalovi poskusi stabilizirat racun prenosne konstante --- s2eps.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/s2eps.py b/s2eps.py index 691a6f2..51434f0 100644 --- a/s2eps.py +++ b/s2eps.py @@ -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)