%% Stability Margins of Models in an Array
% For this example, load invertedPendulumArray.mat, which contains a 3-by-3 array of inverted pendulum SISO models. The mass of the pendulum varies as you move from model to model along a single column of sys, and the length of the pendulum varies as you move along a single row. The mass values used are 100g, 200g and 300g, and the pendulum lengths used are 3m, 2m and 1m respectively.
% \matrix{& Column\enspace1 & Column\enspace2 & Column\enspace3 \cr Row\enspace1 & 100g,3m & 100g,2m & 100g,1m \cr Row\enspace2 & 200g,3m & 200g,2m & 200g,1m \cr Row\enspace3 & 300g,3m & 300g,2m & 300g,1m}

load('invertedPendulumArray.mat','sys');
size(sys)

%
% Find stability margins for all models in the array.

S = allmargin(sys)

% allmargin returns a 3-by-3 structure array S, in which each entry is a structure containing the stability margins of the corresponding entry in sys. For instance, the stability margins of the model with 100g pendulum weight and 2m length is contained in S(1,2).
% Copyright 2012 The MathWorks, Inc.
%