MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / chebyshev1Poly

Function chebyshev1Poly

SLiCAP/SLiCAPmath.py:1391–1425  ·  view source on GitHub ↗

Returns a normalized Chebyshev polynomial of the n-th order of the Laplace variable, with a ripple of dB Zero-frequency value = 1, -3dB frequency (magnitude = 2) is 1 rad/s. :param n: order :type n: int :return: Chebyshev polynomial of the n-th order of the Lapla

(n, ripple)

Source from the content-addressed store, hash-verified

1389 return P_s
1390
1391def chebyshev1Poly(n, ripple):
1392 """
1393 Returns a normalized Chebyshev polynomial of the n-th order of the Laplace
1394 variable, with a ripple of <ripple> dB
1395
1396 Zero-frequency value = 1, -3dB frequency (magnitude = 2) is 1 rad/s.
1397
1398 :param n: order
1399 :type n: int
1400
1401 :return: Chebyshev polynomial of the n-th order of the Laplace variable
1402 :rtype: sympy.Expression
1403 """
1404 s = ini.laplace
1405 eps = np.sqrt(10**(ripple/10)-1)
1406 h = np.tanh((1/n)*np.arcsinh(1/eps))
1407 def a_i(i, n, h): return np.sqrt(
1408 1/(1-h**2) - (np.sin((2*i-1)/n*np.pi/2))**2)
1409
1410 def b_i(i, n, h): return np.sqrt(1 + 1/(h*np.tan((2*i-1)/n*np.pi/2))**2)/2
1411 if n % 2:
1412 P_s = s*np.sqrt(1-h**2)/h + 1
1413 order = int((n-1)/2)
1414 else:
1415 P_s = 1
1416 order = int(n/2)
1417 for i in range(1, order+1):
1418 P_s *= (s/a_i(i, n, h))**2 + s/(a_i(i, n, h)*b_i(i, n, h)) + 1
1419 # Normalize 3 dB frequency
1420 w = sp.Symbol('w', real=True)
1421 B_w = sp.Abs(P_s.xreplace({s: sp.I*w}))**2
1422 func = sp.lambdify(w, B_w - 2)
1423 w3dB = float2rational(fsolve(func, 10)[0])
1424 P_s = P_s.xreplace({s: s*w3dB})
1425 return P_s
1426
1427def _doVarNoiseData(noiseData, numeric, method, CDS, tau, fmin, fmax, points, wf):
1428 """

Callers 1

filterFuncFunction · 0.85

Calls 3

a_iFunction · 0.85
b_iFunction · 0.85
float2rationalFunction · 0.85

Tested by

no test coverage detected