control.describing_function
- control.describing_function(F, A, num_points=100, zero_check=True, try_method=True)[source]
Numerically compute 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
. This function returns the magnitude and
phase of the describing function at amplitude
.- Parameters:
- Fcallable
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_functionthen this method will be used to computing the describing function instead of a nonlinear computation. Some common nonlinearities use theDescribingFunctionNonlinearityclass, which provides this functionality.- Aarray_like
The amplitude(s) at which the describing function should be calculated.
- num_pointsint, optional
Number of points to use in computing describing function (default = 100).
- zero_checkbool, optional
If True (default) then
Ais zero, the function will be evaluated and checked to make sure it is zero. If not, aTypeErrorexception is raised. If zero_check is False, no check is made on the value of the function at zero.- try_methodbool, optional
If True (default), check the
Fargument to see if it is an object with adescribing_functionmethod and use this to compute the describing function. More information in thedescribing_functionmethod for theDescribingFunctionNonlinearityclass.
- Returns:
- dfndarray of complex
The (complex) value of the describing function at the given amplitudes.
- 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