function [a,b,c]=prepsim(M,C,K,f,base);

% This function returns the state space description of the
% system to facilitate simulation

global sys

f=f(:)';

[N,N]=size(M);

if base
   f(1:N)=-sum(M(1:N,:));
   sys.f=f;
end


a=[zeros(N,N) eye(N);-inv(M)*K -inv(M)*C];
b=[zeros(1,N) (inv(M)*f')']';
c=[eye(N) zeros(N,N)];


