%% Map Initial Conditions from Discrete-Time Sparse Second-Order Model to Equivalent First-Order Model
% For this example, consider a discrete-time sparse second-order model with 7102 nodes. The row vectors q1 and q2 are the initial conditions for k and k+1 time steps, respectively. The vectors q1 and q2 have the same size as the number of nodes in sys.
% Load the data in sparseSOD.mat and find the initial conditions for an equivalent discrete-time sparse first-order model using getx0.

load('sparseSOD.mat','sys','q1','q2');
x0 = getx0(sys,q1,q2);
size(x0)

% In this case, vector x0 contains 14204 states since x0 =\left[ \begin{array}{ccc}
% q1 \\
% q2 \end{array} \right].
% Copyright 2020 The MathWorks, Inc.