control.describing_function

control.describing_function(F, A, num_points=100, zero_check=True, try_method=True)[source]

Numerically compute the describing function of a nonlinear function.

The describing function of a nonlinearity is given by magnitude and phase of the first harmonic of the function when evaluated along a sinusoidal input A \sin \omega t. This function returns the magnitude and phase of the describing function at amplitude A.

Parameters
  • F (callable) –

    The function F() should accept a scalar number as an argument and return a scalar number. For compatibility with (static) nonlinear input/output systems, the output can also return a 1D array with a single element.

    If the function is an object with a method describing_function then this method will be used to computing the describing function instead of a nonlinear computation. Some common nonlinearities use the DescribingFunctionNonlinearity class, which provides this functionality.

  • A (array_like) – The amplitude(s) at which the describing function should be calculated.

  • zero_check (bool, optional) – If True (default) then A is zero, the function will be evaluated and checked to make sure it is zero. If not, a TypeError exception is raised. If zero_check is False, no check is made on the value of the function at zero.

  • try_method (bool, optional) – If True (default), check the F argument to see if it is an object with a describing_function method and use this to compute the describing function. More information in the describing_function method for the DescribingFunctionNonlinearity class.

Returns

df – The (complex) value of the describing function at the given amplitudes.

Return type

array of complex

Raises

TypeError – If A[i] < 0 or if A[i] = 0 and the function F(0) is non-zero.

Examples

>>> F = lambda x: np.exp(-x)      # Basic diode description
>>> A = np.logspace(-1, 1, 20)    # Amplitudes from 0.1 to 10.0
>>> df_values = ct.describing_function(F, A)
>>> len(df_values)
20