State-Space Model: Automatically naming InputName / OutputName based on InputGroup, OutputGroup
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
1 comentario
Siva
el 19 de Jun. de 2024
I ran into exactly the same question, and am wondering if there has been a good resolution.
Respuestas (1)
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.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!