function  [sys, x0]  = simom2(t,x,u,flag,a,b,c,d)
% SIMOM2 State-space equation example(2) as an S-function M-file.
%	Represents the state-space equations:
%
%		dx/dt = A.x + B.u
%		y = C.x + D.u
%
%	as an M-file where the matrices, A,B,C,D are provided 
%	externally. 
%	Where x is the state vector, u is vector of inputs,
%	and y is the vector of outputs.
%
%	See also: SIMOM,User's manual under Advanced Topics Section.
%	Copyright (c) 1990-94 by The MathWorks, Inc.

if abs(flag) == 1
    sys = a*x + b*u;
elseif flag == 3
    sys = c*x + d*u;
elseif flag == 0
    sys = [length(a) 0 size(d), 0, 1]; 
    x0 = ones(3,1);
end

