当前位置: 首页>>代码示例>>Python>>正文


Python numpy.polymul方法代码示例

本文整理汇总了Python中numpy.polymul方法的典型用法代码示例。如果您正苦于以下问题:Python numpy.polymul方法的具体用法?Python numpy.polymul怎么用?Python numpy.polymul使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numpy的用法示例。


在下文中一共展示了numpy.polymul方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _polysqr

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import polymul [as 别名]
def _polysqr(pol):
    """return a polynomial squared"""
    return np.polymul(pol, pol)

# Took the framework for the old function by
# Sawyer B. Fuller <minster@caltech.edu>, removed a lot of the innards
# and replaced with analytical polynomial functions for LTI systems.
#
# idea for the frequency data solution copied/adapted from
# https://github.com/alchemyst/Skogestad-Python/blob/master/BODE.py
# Rene van Paassen <rene.vanpaassen@gmail.com>
#
# RvP, July 8, 2014, corrected to exclude phase=0 crossing for the gain
#                    margin polynomial
# RvP, July 8, 2015, augmented to calculate all phase/gain crossings with
#                    frd data. Correct to return smallest phase
#                    margin, smallest gain margin and their frequencies
# RvP, Jun 10, 2017, modified the inclusion of roots found for phase
#                    crossing to include all >= 0, made subsequent calc
#                    insensitive to div by 0
#                    also changed the selection of which crossings to
#                    return on basis of "A note on the Gain and Phase
#                    Margin Concepts" Journal of Control and Systems
#                    Engineering, Yazdan Bavafi-Toosi, Dec 2015, vol 3
#                    issue 1, pp 51-59, closer to Matlab behavior, but
#                    not completely identical in edge cases, which don't
#                    cross but touch gain=1 
开发者ID:python-control,项目名称:python-control,代码行数:29,代码来源:margins.py

示例2: phase_crossover_frequencies

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import polymul [as 别名]
def phase_crossover_frequencies(sys):
    """Compute frequencies and gains at intersections with real axis
    in Nyquist plot.

    Call as:
        omega, gain = phase_crossover_frequencies()

    Returns
    -------
    omega: 1d array of (non-negative) frequencies where Nyquist plot
    intersects the real axis

    gain: 1d array of corresponding gains

    Examples
    --------
    >>> tf = TransferFunction([1], [1, 2, 3, 4])
    >>> PhaseCrossoverFrequenies(tf)
    (array([ 1.73205081,  0.        ]), array([-0.5 ,  0.25]))
    """

    # Convert to a transfer function
    tf = xferfcn._convert_to_transfer_function(sys)

    # if not siso, fall back to (0,0) element
    #! TODO: should add a check and warning here
    num = tf.num[0][0]
    den = tf.den[0][0]

    # Compute frequencies that we cross over the real axis
    numj = (1.j)**np.arange(len(num)-1,-1,-1)*num
    denj = (-1.j)**np.arange(len(den)-1,-1,-1)*den
    allfreq = np.roots(np.imag(np.polymul(numj,denj)))
    realfreq = np.real(allfreq[np.isreal(allfreq)])
    realposfreq = realfreq[realfreq >= 0.]

    # using real() to avoid rounding errors and results like 1+0j
    # it would be nice to have a vectorized version of self.evalfr here
    gain = np.real(np.asarray([tf._evalfr(f)[0][0] for f in realposfreq]))

    return realposfreq, gain 
开发者ID:python-control,项目名称:python-control,代码行数:43,代码来源:margins.py

示例3: test_mem_polymul

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import polymul [as 别名]
def test_mem_polymul(self):
        # Ticket #448
        np.polymul([], [1.]) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:5,代码来源:test_regression.py

示例4: sos2tf

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import polymul [as 别名]
def sos2tf(sos):
    """
    Return a single transfer function from a series of second-order sections

    Parameters
    ----------
    sos : array_like
        Array of second-order filter coefficients, must have shape
        ``(n_sections, 6)``. See `sosfilt` for the SOS filter format
        specification.

    Returns
    -------
    b : ndarray
        Numerator polynomial coefficients.
    a : ndarray
        Denominator polynomial coefficients.

    Notes
    -----
    .. versionadded:: 0.16.0
    """
    sos = np.asarray(sos)
    b = [1.]
    a = [1.]
    n_sections = sos.shape[0]
    for section in range(n_sections):
        b = np.polymul(b, sos[section, :3])
        a = np.polymul(a, sos[section, 3:])
    return b, a 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:32,代码来源:filter_design.py

示例5: test_mem_polymul

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import polymul [as 别名]
def test_mem_polymul(self, level=rlevel):
        # Ticket #448
        np.polymul([], [1.]) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:5,代码来源:test_regression.py

示例6: test_mem_polymul

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import polymul [as 别名]
def test_mem_polymul(self, level=rlevel):
        """Ticket #448"""
        np.polymul([], [1.]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_regression.py

示例7: A_weighting

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import polymul [as 别名]
def A_weighting(fs):
    """Design of an A-weighting filter.

    b, a = A_weighting(fs) designs a digital A-weighting filter for
    sampling frequency `fs`. Usage: y = scipy.signal.lfilter(b, a, x).
    Warning: `fs` should normally be higher than 20 kHz. For example,
    fs = 48000 yields a class 1-compliant filter.

    References:
       [1] IEC/CD 1672: Electroacoustics-Sound Level Meters, Nov. 1996.

    """
    # Definition of analog A-weighting filter according to IEC/CD 1672.
    f1 = 20.598997
    f2 = 107.65265
    f3 = 737.86223
    f4 = 12194.217
    A1000 = 1.9997

    NUMs = [(2*numpy.pi * f4)**2 * (10**(A1000/20)), 0, 0, 0, 0]
    DENs = numpy.polymul([1, 4*numpy.pi * f4, (2*numpy.pi * f4)**2],
                   [1, 4*numpy.pi * f1, (2*numpy.pi * f1)**2])
    DENs = numpy.polymul(numpy.polymul(DENs, [1, 2*numpy.pi * f3]),
                                 [1, 2*numpy.pi * f2])

    # Use the bilinear transformation to get the digital filter.
    # (Octave, MATLAB, and PyLab disagree about Fs vs 1/Fs)
    return bilinear(NUMs, DENs, fs) 
开发者ID:SuperShinyEyes,项目名称:spl-meter-with-RPi,代码行数:30,代码来源:spl_lib.py


注:本文中的numpy.polymul方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。