%% Array of Sparse Second-Order Models
% For this example, consider sparseSOArray.mat which contains three sets of sparse matrices that define multiple sparse second-order state-space models.
% Extract the data from sparseSOArray.mat.

load('sparseSOArray.mat');

% Preallocate a 3-by-1 array of mechss models.

sys = mechss(zeros(1,1,3));

% Next, use indexed assignment to populate the 3-by-1 array with sparse second-order models.

sys(:,:,1) = mechss(M1,[],K1,B1,F1,G1,[]);
sys(:,:,2) = mechss(M2,[],K2,B2,F2,G2,[]);
sys(:,:,3) = mechss(M3,[],K3,B3,F3,G3,[]);
size(sys)

% Alternatively, you can also create an array of sparse second-order models using the stack command when you have models with the same I/O sizes.
% Copyright 2020 The MathWorks, Inc