Python scipy.signal.step如何计算时间

Python scipy.signal.step如何计算时间,python,scipy,signals,Python,Scipy,Signals,scipy.signal.step文件规定,如果未指定,将扣除模拟时间。 如果函数收敛,该时间如何确定 如果它不收敛怎么办?scipy是开源的。目前,代码位于github上。步骤的定义当前处于启用状态。如果您在该文件中搜索def step(system,您将找到函数的定义。然后您将看到step调用私有函数\u default\u response\u次(A,n),其中A是系统矩阵,n是要生成的时间样本数。此函数的完整代码为: def _default_response_times(A, n):

scipy.signal.step文件规定,如果未指定,将扣除模拟时间。 如果函数收敛,该时间如何确定


如果它不收敛怎么办?

scipy
是开源的。目前,代码位于github上。
步骤的定义当前处于启用状态。如果您在该文件中搜索
def step(system
,您将找到函数的定义。然后您将看到
step
调用私有函数
\u default\u response\u次(A,n)
,其中
A
是系统矩阵,
n
是要生成的时间样本数。此函数的完整代码为:

def _default_response_times(A, n):
    """Compute a reasonable set of time samples for the response time.
    This function is used by `impulse`, `impulse2`, `step` and `step2`
    to compute the response time when the `T` argument to the function
    is None.
    Parameters
    ----------
    A : array_like
        The system matrix, which is square.
    n : int
        The number of time samples to generate.
    Returns
    -------
    t : ndarray
        The 1-D array of length `n` of time samples at which the response
        is to be computed.
    """
    # Create a reasonable time interval.
    # TODO: This could use some more work.
    # For example, what is expected when the system is unstable?
    vals = linalg.eigvals(A)
    r = min(abs(real(vals)))
    if r == 0.0:
        r = 1.0
    tc = 1.0 / r
    t = linspace(0.0, 7 * tc, n)
    return t
您可以看到,时间间隔是使用特征值实部绝对值的最小值来选择的。将此值称为r。结束时间仅为7/r(除非r为0,在这种情况下,时间为7)