Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/ControlSystemsBase/src/connections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,9 @@ The manual section [From block diagrams to code](https://juliacontrol.github.io/
See Zhou, Doyle, Glover (1996) for similar (somewhat less symmetric) formulas.
"""
function feedback(sys1::AbstractStateSpace, sys2::AbstractStateSpace;
U1=:, Y1=:, U2=:, Y2=:, W1=:, Z1=:, W2=Int[], Z2=Int[],
Wperm=:, Zperm=:, pos_feedback::Bool=false)
U1::TU1=:, Y1::TY1=:, U2::TU2=:, Y2::TY2=:, W1::TW1=:, Z1::TZ1=:,
W2::TW2=Int[], Z2::TZ2=Int[], Wperm::TWperm=:, Zperm::TZperm=:,
pos_feedback::Bool=false) where {TU1, TY1, TU2, TY2, TW1, TZ1, TW2, TZ2, TWperm, TZperm}

timeevol = common_timeevol(sys1,sys2)
T = Base.promote_type(numeric_type(sys1), numeric_type(sys2))
Expand All @@ -371,10 +372,10 @@ function feedback(sys1::AbstractStateSpace, sys2::AbstractStateSpace;
Z2 isa Number && (Z2 = [Z2])

if (U1 isa Colon ? size(sys1, 2) : length(U1)) != (Y2 isa Colon ? size(sys2, 1) : length(Y2))
error("Lengths of U1 ($U1) and Y2 ($Y2) must be equal")
error("Lengths of U1 and Y2 must be equal")
end
if (U2 isa Colon ? size(sys2, 2) : length(U2)) != (Y1 isa Colon ? size(sys1, 1) : length(Y1))
error("Lengths of U2 ($U2) and Y1 ($Y1) must be equal")
error("Lengths of U2 and Y1 must be equal")
end

α = pos_feedback ? 1 : -1 # The sign of feedback
Expand Down
Loading