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
The output of the bode_plot function is bounded to between -180 degrees and 180 degrees and doesn't account for conditions when the phase should leave these ranges. For example a phase angle of -270 degrees will be represented as 90 degrees on the bode plot. To illustrate this, I've got a simple example below:
import control as ct
m = 2
k = 100_000
Wci = 2*np.pi*500
G1 = ct.TransferFunction([1],[m, 0, -k])
G2 = ct.TransferFunction([1], [1/Wci, 1])
G3 = G1*G2
ct.bode_plot([G1, G2, G3], dB = True, Hz = True)
-G1 (blue curve) contains two poles and a DC gain and has a phase angle of -180 degrees.
-G2 (orange curve) is a simple pole with no DC gain and thus has a phase that starts at 0 degrees and goes to -90 degrees
-G3 (green curve) is the product of the two transfer functions which on the bode plot corresponds to adding of the curves. We should see the green curve start at a phase of -180 degrees and go to -270 degrees but it does not do this because of the way that the phase angle is computed.
The text was updated successfully, but these errors were encountered:
Bode plots can represent phase outside of -180 to 180. For example, if you change your example to have a positive spring constant with some damping, it gives you a more natural plot:
import numpy as np
import control as ct
m = 2
k = 100_000
d = 100
Wci = 2*np.pi*500
G1 = ct.TransferFunction([1],[m, d, k])
G2 = ct.TransferFunction([1], [1/Wci, 1])
G3 = G1*G2
ct.bode_plot([G1, G2, G3], dB = True, Hz = True)
Coming back to your example, the bode_plot function has to make some guesses about what the initial phase is. This is what is causing the problem in your plots. We can probably make things more "natural" here (volunteers to do this are welcome -:). It might also be nice to add a way to set the initial phase of the plot and/or separate the generation of the frequency response from plotting in a better way (see issue #65).
The "fix" I can suggest is to store the return values from bode_plot and then plot by hand (sorry -:).
murrayrm
changed the title
Bode Plot Phase Bounded to Between -180 and 180 Degrees
Allow the initial phase of a bode plot to be specified
Jul 11, 2020
The output of the
bode_plot
function is bounded to between -180 degrees and 180 degrees and doesn't account for conditions when the phase should leave these ranges. For example a phase angle of -270 degrees will be represented as 90 degrees on the bode plot. To illustrate this, I've got a simple example below:-G1 (blue curve) contains two poles and a DC gain and has a phase angle of -180 degrees.
-G2 (orange curve) is a simple pole with no DC gain and thus has a phase that starts at 0 degrees and goes to -90 degrees
-G3 (green curve) is the product of the two transfer functions which on the bode plot corresponds to adding of the curves. We should see the green curve start at a phase of -180 degrees and go to -270 degrees but it does not do this because of the way that the phase angle is computed.
The text was updated successfully, but these errors were encountered: