@@ -69,52 +69,6 @@ function getpoles(G, K::AbstractVector{T}) where {T<:Number}
6969 copy (poleout' ), K
7070end
7171
72- # function getpoles(sys::StateSpace, K_matrix::AbstractMatrix; tol = 1e-6)
73- # # Ensure the system is StateSpace (already enforced by method signature)
74- # A, B = sys.A, sys.B
75- # nx = size(A, 1) # State dimension
76-
77- # # Check for compatibility of K_matrix dimensions with B
78- # if size(K_matrix, 2) != nx
79- # error("The number of columns in K_matrix ($(size(K_matrix, 2))) must match the number of states ($(nx)).")
80- # end
81- # # The number of rows in K_matrix must match the number of inputs (columns of B)
82- # if size(K_matrix, 1) != size(B, 2)
83- # error("The number of rows in K_matrix ($(size(K_matrix, 1))) must match the number of inputs (columns of B, which is $(size(B, 2))).")
84- # end
85-
86- # poleout = Matrix{ComplexF64}(undef, nx, length(k_values))
87- # D = zeros(nx, nx) # distance matrix for Hungarian algorithm
88- # temppoles = zeros(ComplexF64, nx) # temporary storage for sorted poles
89-
90- # prevpoles = ComplexF64[] # Initialize prevpoles for the first iteration
91-
92- # stepsize = 1e-6
93- # k_scalar = 0.0
94-
95- # while k_scalar < 1
96- # A_cl = A - k_scalar * B * K_matrix
97- # current_poles = eigvals(A_cl)
98-
99- # if i > 1 && length(current_poles) == length(prevpoles)
100- # for r in 1:nx
101- # for c in 1:nx
102- # D[r, c] = abs(current_poles[r] - prevpoles[c])
103- # end
104- # end
105- # assignment, cost = Hungarian.hungarian(D)
106- # for j = 1:nx
107- # temppoles[assignment[j]] = current_poles[j]
108- # end
109- # poleout[:, i] .= temppoles
110- # else
111- # poleout[:, i] .= current_poles # For the first iteration or mismatch, just assign
112- # end
113- # prevpoles = poleout[:, i] # Update prevpoles for the next iteration
114- # end
115- # return copy(poleout'), k_values .* Ref(K_matrix) # Return transposed pole matrix and k_values as a vector
116- # end
117-
11872"""
11973 getpoles(sys::StateSpace, K::AbstractMatrix; tol = 1e-2, initial_stepsize = 1e-3, output=false)
12074
0 commit comments