GeezerVison is showing github.com — Phase shift in bode plot · Issue #467 · python-control/python-control
Phase shift in bode plot #467DescriptionGiven the transfer function
G = 1/s^3
We should see a constant negative phase of -270°, which is confirmed in matlab

However, both control.bode and control.matlab.bode give 90° instead of -270°. Although technically the same value, it does get confusing.
import control
import control.matlab
s = control.tf('s')
G = 1/s**3
control.bode(G);


What i've tried so far
Is it possible to get the "absolute" phase of the transfer function ? If not, i would suggest that control.matlab.bode be corrected as to reflect the behavior of matlab's bode
Thanks for your help ! ActivitySebastienDeriaz commented on Nov 10, 2020 My (limited) understanding of the function is that bode uses freqresp which uses evalfr and then numpy.angle. Since evalfr returns a complex number it isn't directly possible to get the "absolute" angle so the issue i'm reporting seems to require a dedicated code to determine a "reference phase" of some sort.
My excuses for my current level of python (or gitHub) doesn't lead me much further than that bnavigator commented on Nov 10, 2020 Thanks, for bringing this up.
Related issue: #388
My excuses for my current level of python (or gitHub) doesn't lead me much further than that
You are nevertheless very welcome to practice your Python and GitHub skills by trying to fix the issue and submitting a pull request 🧑🎓 ilayn commented on Nov 10, 2020 The phase correction is only possible when you have the pole-zero structure and the behavior w->0, so you have to compute the initial phase to get the right amount of shift which is typically done with a decision of adding a minus sign attached to the atan2 computation.
When you supply a custom frequency grid then it is trickier to snap to the correct phase since then you have to evaluate more stuff to get to that grid from the pole-zero structure (if there is any, say FRD objects don't have it). Reacted by Juan Pablo Pierini bnavigator commented on Jan 3, 2021 Resolved in #494. If you think this is not solved, please reopen. Juan-Gg commented on Aug 9, 2023 It seems to work with poles, but it does not with zeros.
For a single zero a constant phase of 90º would be expected, it gives -270º instead.
from matplotlib import pyplot as plt
from control.matlab import * # MATLAB-like functions
%matplotlib widget
s = tf('s')
G = (s)
plt.figure()
bode(G, wrap_phase = False)
plt.show()

MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|