You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This function computes a list of damping coefficients based on the limits
of the graph. A set of 4 damping coefficients are computed for the x-axis
and a set of three damping coefficients are computed for the y-axis
(corresponding to the normal 4:3 plot aspect ratio in `matplotlib`?).
Parameters
----------
xlim : array_like
List of x-axis limits [min, max]
ylim : array_like
List of y-axis limits [min, max]
Returns
-------
zeta : list
List of default damping coefficients for the plot
"""
# Damping coefficient lines that intersect the x-axis
sep1 = -xlim[0] / 4
ang1 = [np.arctan((sep1*i)/ylim[1]) for i in np.arange(1, 4, 1)]
# Damping coefficient lines that intersection the y-axis
sep2 = ylim[1] / 3
ang2 = [np.arctan(-xlim[0]/(ylim[1]-sep2*i)) for i in np.arange(1, 3, 1)]
# Put the lines together and add one at -pi/2 (negative real axis)
angles = np.concatenate((ang1, ang2))
angles = np.insert(angles, len(angles), np.pi/2)
# Return the damping coefficients corresponding to these angles
zeta = np.sin(angles)
return zeta.tolist()
def _default_wn(xloc, ylim):
"""Return default wn for root locus plot"""
"""Return default wn for root locus plot
This function computes a list of natural frequencies based on the grid
parameters of the graph.
Parameters
----------
xloc : array_like
List of x-axis tick values
ylim : array_like
List of y-axis limits [min, max]
Returns
-------
wn : list
List of default natural frequencies for the plot
"""
wn = xloc # one frequency per x-axis tick mark
sep = xloc[1]-xloc[0] # separation between ticks
wn = xloc
sep = xloc[1]-xloc[0]
# Insert additional frequencies to span the y-axis
while np.abs(wn[0]) < ylim[1]:
wn = np.insert(wn, 0, wn[0]-sep)
# If there are too many values, cut them in half
while len(wn) > 7:
wn = wn[0:-1:2]
Expand Down
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.