%% Check Passivity of Models in Array
% You can use isPassive to evaluate the passivity of multiple models in a model array simultaneously. For this example, generate a random array of transfer function models.

G = rss(3,1,1,1,5);

%
% G is a 1-by-5 array of 3-state SISO models. Check the passivity of all the models in G.

[pf,R] = isPassive(G)

%
% pf and R are also 1-by-5 arrays. Each pf entry indicates whether the corresponding model in G is passive. Likewise, each R value gives the relative excess or shortage of passivity in the corresponding model in G. For instance, examine the passivity of the second entry in G, and compare the result with the second entries in pf and R.

[pf2,R2] = isPassive(G(:,:,2))

% Copyright 2012 The MathWorks, Inc.