diff --git a/lib/ControlSystemsBase/src/ControlSystemsBase.jl b/lib/ControlSystemsBase/src/ControlSystemsBase.jl index bc9fd9793..62177631c 100644 --- a/lib/ControlSystemsBase/src/ControlSystemsBase.jl +++ b/lib/ControlSystemsBase/src/ControlSystemsBase.jl @@ -80,6 +80,8 @@ export LTISystem, output_comp_sensitivity, G_PS, G_CS, + resolvent, + input_resolvent, # Discrete c2d, c2d_x0map, diff --git a/lib/ControlSystemsBase/src/sensitivity_functions.jl b/lib/ControlSystemsBase/src/sensitivity_functions.jl index fe64b966c..e84d7b0c5 100644 --- a/lib/ControlSystemsBase/src/sensitivity_functions.jl +++ b/lib/ControlSystemsBase/src/sensitivity_functions.jl @@ -173,3 +173,32 @@ function extended_gangoffour(P, C, pos=true) end end +""" + input_resolvent(sys::AbstractStateSpace) + +Return the input-mapped resolvent of `sys` +```math +(sI - A)^{-1}B +``` +i.e., the system `ss(A, B, I, 0)`. +""" +function input_resolvent(sys::AbstractStateSpace) + A,B,C,D = ssdata(sys) + ss(A, B, I, 0, timeevol(sys)) +end + +""" + resolvent(sys::AbstractStateSpace) + +Return the resolvent of `sys` +```math +(sI - A)^{-1} +``` +i.e., the system `ss(A, I, I, 0)`. + +See also [`input_resolvent`](@ref). +""" +function resolvent(sys::AbstractStateSpace) + A,B,C,D = ssdata(sys) + ss(A, I(sys.nx), I, 0, timeevol(sys)) +end \ No newline at end of file diff --git a/lib/ControlSystemsBase/test/test_connections.jl b/lib/ControlSystemsBase/test/test_connections.jl index ce024bf10..e84b88e9f 100644 --- a/lib/ControlSystemsBase/test/test_connections.jl +++ b/lib/ControlSystemsBase/test/test_connections.jl @@ -416,4 +416,16 @@ function feedback_ctrl(G, K) end @test_throws ErrorException feedback_ctrl(tf([1], [0.1, 1]), delay(0.1)) +Pr = resolvent(P) +@test Pr.A == P.A +@test Pr.B == I +@test Pr.C == I +@test iszero(Pr.D) + +Pr = input_resolvent(P) +@test Pr.A == P.A +@test Pr.B == P.B +@test Pr.C == I +@test iszero(Pr.D) + end \ No newline at end of file