Simulink Control Design™ - MathWorks

(Tuis.) #1

mdl = 'scdindex1';
mdlpath = fullfile(matlabroot,'examples','slcontrol',mdl);
open_system(mdlpath)


Create an operating point specification for model.


opspec = operspec(mdl);


opspec contains an array of state specifications for the model.


opspec.States


(1.) scdindex1/system1
spec: dx = 0, initial guess: 0
spec: dx = 0, initial guess: 0
spec: dx = 0, initial guess: 0
(2.) scdindex1/system2
spec: dx = 0, initial guess: 0


Get the index of the state specification that corresponds to the system2 block.


index2 = getStateIndex(opspec,'scdindex1/system2')


index2 =


2 1


index2(1) is the index of the state specification object for system2 in opspec.States.
Since this block has a single state, index2 has a single row and index2(2) is 1.


If a block has multiple states, you can obtain the indices of all the states in the
corresponding state specification.


getStateIndex
Free download pdf