State space feedback

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 :slight_smile:

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])