Skip to content
Discussion options

You must be logged in to vote

you can do this with ordinary matplotlib sliders. keep the plant fixed and rebuild the compensator in the slider callback:

C = K * (s + z) / (s + p)
L = C * G
T = ct.feedback(L, 1)

then update the existing plot lines using ct.frequency_response(L, w) and ct.step_response(T, t). no notebook needed.

the example below has sliders for all three parameters. z and p are positive here, so the actual zero and pole are at -z and -p. the Bode plots show L; the step plot shows T. it hides the step response if the closed loop becomes unstable.

run it as a script with an interactive matplotlib backend.

"""Run with Python using an interactive Matplotlib backend (e.g. TkAgg/QtAgg)."""
import control as ct

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sawyerbfuller
Comment options

Comment options

You must be logged in to vote
2 replies
@sawyerbfuller
Comment options

@oneEclipseUser1
Comment options

Comment options

You must be logged in to vote
1 reply
@oneEclipseUser1
Comment options

Answer selected by oneEclipseUser1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants