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
Copy file name to clipboardExpand all lines: lib/ControlSystemsBase/src/analysis.jl
+41Lines changed: 41 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,47 @@ function poles(sys::TransferFunction{<:TimeEvolution,SisoZpk{T,TR}}) where {T, T
37
37
return lcmpoles
38
38
end
39
39
40
+
41
+
functioncount_eigval_multiplicity(p, location)
42
+
T =float(real(eltype(p)))
43
+
n =length(p)
44
+
n ==0&&return0
45
+
maximum(1:n) do i
46
+
# if we count i poles within the circle assuming i integrators, we return i
47
+
ifcount(p->abs(p-location) < (i+1)*(eps(T)^(1/i)), p) >= i
48
+
i
49
+
else
50
+
0
51
+
end
52
+
end
53
+
end
54
+
55
+
"""
56
+
count_integrators(P)
57
+
58
+
Count the number of poles in the origin by finding the maximum value of `n` for which the number of poles within a circle of radius `(n+1)*eps(numeric_type(sys))^(1/n)` arount the origin (1 in discrete time) equals `n`.
59
+
"""
60
+
functioncount_integrators(P::LTISystem)
61
+
p =poles(P)
62
+
location =iscontinuous(P) ?0:1
63
+
count_eigval_multiplicity(p, location)
64
+
end
65
+
66
+
"""
67
+
integrator_excess(P)
68
+
69
+
Count the number of integrators in the system by finding the difference between the number of poles in the origin and the number of zeros in the origin. If the number of zeros in the origin is greater than the number of poles in the origin, the count is negative.
70
+
71
+
For discrete-tiem systems, the origin ``s = 0`` is replaced by the point ``z = 1``.
Copy file name to clipboardExpand all lines: lib/ControlSystemsBase/src/plotting.jl
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -253,6 +253,7 @@ optionally provided. To change the Magnitude scale see [`setPlotScale`](@ref). T
253
253
254
254
- If `hz=true`, the plot x-axis will be displayed in Hertz, the input frequency vector is still treated as rad/s.
255
255
- `balance`: Call [`balance_statespace`](@ref) on the system before plotting.
256
+
- `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.
256
257
257
258
`kwargs` is sent as argument to RecipesBase.plot.
258
259
"""
@@ -274,7 +275,7 @@ function _get_plotlabel(s, i, j)
Copy file name to clipboardExpand all lines: lib/ControlSystemsBase/src/simplification.jl
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,11 @@ function struct_ctrb_states(A::AbstractVecOrMat, B::AbstractVecOrMat)
47
47
# UInt16 can only store up to 65535, so if A is completely dense and of size larger than 65535, the computations below might overflow. This is exceedingly unlikely though.
48
48
bitA =UInt16.(.!iszero.(A)) # Convert to Int because multiplying with a bit matrix is slow
49
49
x =vec(any(B .!=0, dims=2)) # index vector indicating states that have been affected by input
50
-
xi = bitA * x
50
+
if A isa SMatrix
51
+
xi =Vector(bitA * x) # To aboid setindex! error below
52
+
else
53
+
xi = bitA * x
54
+
end
51
55
xi2 =similar(xi)
52
56
@. xi = (xi !=false) |!iszero(x)
53
57
for i =2:size(A, 1) # apply A nx times, similar to controllability matrix
0 commit comments