Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

I'm having problems with theax parameters of therlocus function #623

Closed
Labels
@jolenscki

Description

@jolenscki

I was trying today to plot the root locus of a transfer function, but wanted to pass a specific axes object to it, so I tried to use theax parameter of therlocus function:

from control import *import matplotlib.pyplot as plts = tf([1, 0], 1)G = 1/(s*(s+1))fig, ax = plt.subplots(dpi=200)rlocus(G, ax=ax)

But when doing this, the following error was raised:

---------------------------------------------------------------------------UnboundLocalError                         Traceback (most recent call last)<ipython-input-1-80498c4b1a54> in <module>      6       7 fig, ax = plt.subplots(dpi=200)----> 8 rlocus(G, ax=ax)~\anaconda3\lib\site-packages\control\rlocus.py in root_locus(sys, kvect, xlim, ylim, plotstr, plot, print_gain, grid, ax, **kwargs)    173     174         if print_gain and not sisotool:--> 175             fig.canvas.mpl_connect(    176                 'button_release_event',    177                 partial(_RLClickDispatcher, sys=sys, fig=fig,UnboundLocalError: local variable 'fig' referenced before assignment

Control version: 0.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp