This function creates permutation matrices, which allows to permute the in- and output channels of an uncertain plant M in accordance with the given uncertainty blocks. This is an function that is used in, for example, iqcanalysis, and can also be used independently in another context or to set up an alternative analysis of controller synthesis problem.
Given the some matrix or system with and being the number of input and output channels respectively, the function creates the permutation matrices and based on the input/output channel selectors and , which are structures.
With , , , and , we obtain:
Then the matrix
would permute into