%% Model Reduction to Specified Order
% When you have particular target order or orders in mind, you can use balancmr to reduce a high-order model to those orders. For this example, use a random 30th-order state-space model.

rng(1234,'twister');     % fix random seed for example repeatability
G = rss(30,5,4);

%
% Use a scalar input argument to reduce the model to a single order. For example, compute a 20th-order approximation.

[G1,info1] = balancmr(G,20);
sigma(G,G1)

%
% Use a vector to generate several approximations. The following command returns an array of models of even orders from 10 to 18.

[G2,info2] = balancmr(G,[10:2:18]);
sigma(G,G2)

% Copyright 2012 The MathWorks, Inc.