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: docs/src/man/introduction.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,14 @@ For workflows that do not require continuous-time simulation, you may instead op
10
10
```julia
11
11
using Pkg; Pkg.add("ControlSystemsBase")
12
12
```
13
-
ControlSystemsBase contains all functionality of ControlSystems except continuous-time simulation and root locus, and is *considerably* faster to load and precompile. To enjoy the faster pre-compilation, do not even install ControlSystems since this will cause pre-compilation of OrdinaryDiffEq, which can take several minutes.
13
+
ControlSystemsBase contains all functionality of ControlSystems except continuous-time simulation, and is *considerably* faster to load and precompile. To enjoy the faster pre-compilation, do not even install ControlSystems since this will cause pre-compilation of OrdinaryDiffEq, which can take several minutes.
If a SISO system is passed, the feedback gain `K` is a scalar that ranges from 0 to `K` (if provided). If a `StateSpace` system is passed, `K` is a matrix that defines the feedback gain, and the poles are computed as `K` ranges from `0*K` to `1*K`. In this case, `K` is assumed to be a state-feedback matrix of dimension `(nu, nx)`. To compute the poles for output feedback, pass `output = true` and `K` of dimension `(nu, ny)`.
12
+
"""
13
+
rlocusplot
14
+
5
15
6
-
functiongetpoles(G, K::Number; kwargs...)
7
-
issiso(G) ||error("root locus only supports SISO systems")
16
+
functiongetpoles(G, K::Number; tol =1e-2, initial_stepsize =1e-3, kwargs...)
17
+
issiso(G) ||error("root locus with scalar gain only supports SISO systems, did you intend to pass a feedback gain matrix `K`?")
8
18
G isa TransferFunction || (G =tf(G))
9
19
P =numpoly(G)[]
10
20
Q =denpoly(G)[]
11
21
T =float(typeof(K))
12
22
ϵ =eps(T)
13
23
nx =length(Q)
14
-
D =zeros(nx-1, nx-1) # distance matrix
15
-
prevpoles = ComplexF64[]
24
+
25
+
# Scale tolerance with system order
26
+
tol = tol * (nx -1)
27
+
28
+
poleout_list =Vector{Vector{ComplexF64}}() # To store pole sets at each accepted step
29
+
k_scalars_collected = Float64[] # To store accepted k_scalar values
30
+
31
+
prevpoles = ComplexF64[] # Initialize prevpoles for the first iteration
16
32
temppoles =zeros(ComplexF64, nx-1)
17
-
f =function (_,_,k)
33
+
D =zeros(nx-1, nx-1) # distance matrix
34
+
35
+
stepsize = initial_stepsize
36
+
k_scalar =0.0
37
+
38
+
# Function to compute poles for a given k value
39
+
compute_poles =function(k)
18
40
if k ==0&&length(P) >length(Q)
19
41
# More zeros than poles, make sure the vector of roots is of correct length when k = 0
20
42
# When this happens, there are fewer poles for k = 0, these poles can be seen as being located somewhere at Inf
21
43
# We get around the problem by not allowing k = 0 for non-proper systems.
Compute the root locus of the SISO LTISystem `P` with a negative feedback loop and feedback gains between 0 and `K`. `rlocus` will use an adaptive step-size algorithm to determine the values of the feedback gains used to generate the plot.
235
+
Compute the root locus of the LTISystem `P` with a negative feedback loop and feedback gains between 0 and `K`. `rlocus` will use an adaptive step-size algorithm to determine the values of the feedback gains used to generate the plot.
173
236
174
237
`roots` is a complex matrix containing the poles trajectories of the closed-loop `1+k⋅G(s)` as a function of `k`, `Z` contains the zeros of the open-loop system `G(s)` and `K` the values of the feedback gain.
0 commit comments