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

Function _dB_magFunc_f

SLiCAP/SLiCAPmath.py:898–929  ·  view source on GitHub ↗

Calculates the dB magnitude at the real frequency f (Fourier) from the univariate function 'LaplaceExpr' of the Laplace variable. If ini.hz == true, the Laplace variable will be replaced with 2*sp.pi*sp.I*ini.frequency. If ini.hz == False, the Laplace variable will be replaced

(LaplaceExpr, f)

Source from the content-addressed store, hash-verified

896 return result
897
898def _dB_magFunc_f(LaplaceExpr, f):
899 """
900 Calculates the dB magnitude at the real frequency f (Fourier) from the
901 univariate function 'LaplaceExpr' of the Laplace variable.
902
903 If ini.hz == true, the Laplace variable will be replaced with
904 2*sp.pi*sp.I*ini.frequency.
905
906 If ini.hz == False, the Laplace variable will be replaced with
907 sp.I*ini.frequency.
908
909 :param LaplaceExpr: Univariate function of the Laplace variable.
910 :type LaplaceExpr: sympy.Expr
911
912 :param f: Frequency value (*float*), or a numpy array with frequency values
913 (*float*).
914
915 :return: dB Magnitude at the specified frequency, or list with dB magnitudes
916 at the specified frequencies.
917
918 :rtype: float, numpy.array
919 """
920 LaplaceExpr = normalizeRational(sp.N(LaplaceExpr))
921 if type(f) == list:
922 f = np.array(f)
923 if ini.hz == True:
924 data = LaplaceExpr.xreplace({ini.laplace: 2*sp.pi*sp.I*ini.frequency})
925 else:
926 data = LaplaceExpr.xreplace({ini.laplace: sp.I*ini.frequency})
927 result = _makeNumData(20*sp.log(sp.Abs(sp.N(data)), 10),
928 ini.frequency, f, normalize=False)
929 return result
930
931def _phaseFunc_f(LaplaceExpr, f):
932 """

Callers 1

plotSweepFunction · 0.90

Calls 2

normalizeRationalFunction · 0.85
_makeNumDataFunction · 0.85

Tested by

no test coverage detected