This function estimates a useful frequency range for the Bode plot of a vector of zeros (numerator or denominator zeros). This frequency range is estimated such that the phase angle of one zero is in the range:
phi_min/n_zeros ≤ |phase angle| ≤ pi/2 - phi_min/n_zeros
where n_zeros is the number of zeros. Note, the phase angle of one zero for a frequency of 0 up to infinity is in the range:
0 ≤ |phase angle| ≤ pi/2
Therefore, the frequency range is estimated such that the essential part of the phase angle (defined by phi_min) is present.
If the real part of a complex zero vanishes (i.e., the zero is located on the imaginary axis), the maximum value of the bode plot magnitude of the zero is infinity. In order to avoid difficulties, zeros close to the imaginary axis are shifted by the input argument real_min along the real axis.
function frequencyRangeZeros extends Modelica.Icons.Function; import Modelica.Math; import Modelica.Units.SI; input Complex z[:] "Vector of zeros"; input SI.Angle phi_min(min = 10*Modelica.Constants.eps) = Modelica.Units.Conversions.from_deg(5) "Minimum phase angle"; input Real real_min(min = 0) = 1.e-4 "|r| < real_min are treated as |real_min|"; output SI.AngularVelocity w_min "Minimum frequency"; output SI.AngularVelocity w_max "Maximum frequency"; output Boolean useFullRange = true; end frequencyRangeZeros;