Get signal names from a system
Inputs
- sys
- system data structure for the state space system
- sigid
- signal id. String. Must be one of
"in"- input signals
"out"- output signals
"st"- stage signals
"yd"- value of logical vector yd
- signum
- index(indices) or name(s) or signals; see
sysidx- strflg
- flag to return a string instead of a cell array; Values:
0- (default) return a cell array (even if signum specifies an individual signal)
1- return a string. Exits with an error if signum does not specify an individual signal.
Outputs
- •If sigid is not specified:
- stname
- inname
- outname
- signal names (cell array of strings); names of states, inputs, and outputs, respectively.
- yd
- binary vector; yd(ii) is nonzero if output ii is discrete.
- •If sigid is specified but signum is not specified:
sigid="in"- siglist is set to the cell array of input names.
sigid="out"- siglist is set to the cell array of output names.
sigid="st"- siglist is set to the cell array of state names.
stage signals
sigid="yd"- siglist is set to logical vector indicating discrete outputs; siglist(ii) = 0 indicates that output ii is continuous (unsampled), otherwise it is discrete.
- •If the first three input arguments are specified:
- signame is a cell array of the specified signal names (sigid is
"in","out", or"st"), or else the logical flag indicating whether output(s) signum is(are) discrete (sigval=1) or continuous (sigval=0).Examples (From
sysrepdemo)octave> sys=ss(rand(4),rand(4,2),rand(3,4)); octave># get all signal names octave> [Ast,Ain,Aout,Ayd] = sysgetsignals(sys) Ast = ( [1] = x_1 [2] = x_2 [3] = x_3 [4] = x_4 ) Ain = ( [1] = u_1 [2] = u_2 ) Aout = ( [1] = y_1 [2] = y_2 [3] = y_3 ) Ayd = 0 0 0 octave> # get only input signal names: octave> Ain = sysgetsignals(sys,"in") Ain = ( [1] = u_1 [2] = u_2 ) octave> # get name of output 2 (in cell array): octave> Aout = sysgetsignals(sys,"out",2) Aout = ( [1] = y_2 ) octave> # get name of output 2 (as string): octave> Aout = sysgetsignals(sys,"out",2,1) Aout = y_2