This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Build model array by stacking models or model arrays along array dimensions


sys = stack(arraydim,sys1,sys2,...)


sys = stack(arraydim,sys1,sys2,...) produces an array of dynamic system models sys by stacking (concatenating) the models (or arrays) sys1,sys2,... along the array dimension arraydim. All models must have the same number of inputs and outputs (the same I/O dimensions), but the number of states can vary. The I/O dimensions are not counted in the array dimensions. For more information about model arrays and array dimensions, see Model Arrays.

For arrays of state-space models with variable order, you cannot use the dot operator (e.g., sys.A) to access arrays. Use the syntax

[A,B,C,D] = ssdata(sys,'cell')

to extract the state-space matrices of each model as separate cells in the cell arrays A, B, C, and D.


Example 1

If sys1 and sys2 are two models:

  • stack(1,sys1,sys2) produces a 2-by-1 model array.

  • stack(2,sys1,sys2) produces a 1-by-2 model array.

  • stack(3,sys1,sys2) produces a 1-by-1-by-2 model array.

Example 2

Stack identified state-space models derived from the same estimation data and compare their bode responses.

load iddata1 z1
sysc = cell(1,5);
opt = ssestOptions('Focus','simulation');
for i = 1:5
sysc{i} = ssest(z1,i-1,opt);
sysArray = stack(1, sysc{:});

Introduced before R2006a

Was this topic helpful?