State-Space Model: Automatically naming InputName / OutputName based on InputGroup, OutputGroup

14 visualizaciones (últimos 30 días)
If you take a MIMO state-space model and assign a single name to either the InputName or OutputName property, MATLAB intelligently adds indices to the name for you.
For example, the following will make the input names be u(1), u(2), u(3), u(4)
%Create random model with 4 states, 4 inputs, 4 outputs
G = rss(4,4,4);
%Rename all 4 inputs
G.InputName = 'u';
I would like to rename a subset of the inputs (or outputs) to an indexed name. For example, I might want to break my four inputs above into a control group u(1), u(2) and a disturbance group w(1), w(2). However, if I attempt to do this, MATLAB no longer indexes the name. Instead it gives them the same name and warns me that I have duplicate names. This seems like a poor approach.
%Try to rename as inputs and disturbances
G.InputName(1:2) = {'u'};
G.InputName(3:4) = {'w'};
The above will just set the names of inputs 1 and 2 to 'u', and 3 and 4 to 'w'. Currently I am manually achieving what I want:
for k = 1:2
G.InputName(k) = {['u(' num2str(k) ')']};
end
for k = 3:4
G.InputName(k) = {['w(' num2str(k-2) ')']};
end
Obviously the above is not a painful workaround. But I'm wondering if I'm missing a better approach? I know the InputGroup and OutputGroup allows me to group channels. But this does not link up with the connect() function, which looks at the InputName and OutputName properties.

Respuestas (1)

M
M el 21 de Oct. de 2017
Maybe using the
sys = idss(A,B,C,D,K)
where disturbance elements are given by the matrix K.
  1 comentario
jdg
jdg el 21 de Oct. de 2017
No, that's for system identification. It doesn't offer anything beyond normal ss(A,B,C,D) in terms of conveniently setting InputName and OutputName values.

Iniciar sesión para comentar.

Categorías

Más información sobre Uncertainty Analysis en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by