Hello and welcome to the forum!
Please read Please read: make it easier to help you to learn how to quote your code, and try to include code for an example that runs
When you index back[1,1]
you get a SISO system, you must somehow account for the second output of Model
before you call feedback
, i.e., by making C
a 1x2 system?
Alternatively, if you want C
to operate on one of the outputs only, but keep the second output when you form the closed-loop system, you need to use the advanced interface to feedback
where you specify which inputs and outputs are involved in the feedback, and which are considered external.
feedback(sys1::AbstractStateSpace, sys2::AbstractStateSpace;
U1=:, Y1=:, U2=:, Y2=:, W1=:, Z1=:, W2=Int[], Z2=Int[],
Wperm=:, Zperm=:, pos_feedback::Bool=false)
Basic use feedback(sys1, sys2) forms the feedback
interconnection
ββββββββββββββββ
ββββββββββββ€ sys1 ββββββ Ξ£ βββββββ
β β β β
β ββββββββββββββββ -1
β |
β ββββββββββββββββ β
βββββββΊβ sys2 ββββββββ
β β
ββββββββββββββββ
Advanced use feedback also supports more flexible use according
to the figure below
ββββββββββββββββ
z1βββββββ€ sys1 ββββββββw1
ββββ y1βββββββ€ ββββββββu1 βββ
β ββββββββββββββββ β
β Ξ±
β ββββββββββββββββ β
ββββΊ u2ββββββΊβ sys2 βββββββββΊy2βββ
w2ββββββΊβ βββββββββΊz2
in your case, you would have to provide Z1 = :
and Y1=[1]
or Y1=[2]
depending on which output is fed back to the controller, e.g.,
feedback(Model, C, Y1=[1])