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
# We have to access the actual phase value from the `phase` array to get unwrapped phase. This value is not fully accurate since it is computed at a grid point, so we compute the more accurate phase at the interpolated frequency. This accurate value is not unwrapped, so we add an integer multiple of 360 to get the closest unwrapped phase.
503
+
φ_nom =rad2deg(angle(freqresp(sys,wpm[i])[1]))
504
+
φ_rounded = phase[clamp(round(Int, fi[i]), 1, length(phase))] # fi is interpolated, so we round to the closest integer
Copy file name to clipboardExpand all lines: lib/ControlSystemsBase/src/connections.jl
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -215,6 +215,10 @@ function /(sys1::Union{StateSpace,AbstractStateSpace}, sys2::LTISystem)
215
215
sys1new, sys2new =promote(sys1, 1/sys2)
216
216
return sys1new*sys2new
217
217
end
218
+
function/(sys1::Union{StateSpace,AbstractStateSpace}, sys2::TransferFunction) # This method is handling ambiguity between method above and one with explicit TF as second argument, hit by ss(1)/tf(1)
Copy file name to clipboardExpand all lines: lib/ControlSystemsBase/src/plotting.jl
+25-8Lines changed: 25 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -293,6 +293,9 @@ end
293
293
else
294
294
sbal = s
295
295
end
296
+
if plotphase && adjust_phase_start &&isrational(sbal)
297
+
intexcess =integrator_excess(sbal)
298
+
end
296
299
mag, phase =bode(sbal, w; unwrap=false)
297
300
if _PlotScale =="dB"# Set by setPlotScale(str) globally
298
301
mag =20*log10.(mag)
@@ -330,7 +333,6 @@ end
330
333
plotphase ||continue
331
334
332
335
if adjust_phase_start ==true&&isrational(sbal)
333
-
intexcess =integrator_excess(sbal)
334
336
if intexcess !=0
335
337
# Snap phase so that it starts at -90*intexcess
336
338
nineties =round(Int, phasedata[1] /90)
@@ -429,7 +431,7 @@ nyquistplot
429
431
if lab !==nothing
430
432
label --> lab
431
433
end
432
-
hover --> [hz ? Printf.@sprintf("f = %.3f", w/2π) : Printf.@sprintf("ω = %.3f", w) for w in w]
434
+
hover --> [hz ? Printf.@sprintf("f = %.3g", w/2π) : Printf.@sprintf("ω = %.3g", w) for w in w]
433
435
(redata, imdata)
434
436
end
435
437
@@ -725,11 +727,12 @@ Plot all the amplitude and phase margins of the system(s) `sys`.
725
727
726
728
- A frequency vector `w` can be optionally provided.
727
729
- `balance`: Call [`balance_statespace`](@ref) on the system before plotting.
730
+
- `adjust_phase_start`: If true, the phase will be adjusted so that it starts at -90*intexcess degrees, where `intexcess` is the integrator excess of the system.
0 commit comments