function [hist_x,y] = simula_DLTI_StateSpace_continuo_mor(A,B,C,D,u,x0,Ts)

%

% Eulero Implicito:   x(k+1) = (I-Ts*A)^{-1} * (x(k) + Ts*B*u(k))

%                     y(k)   = C*x(k) + D*u(k);



hist_x = [];

N = length(u);

y = zeros(N,1);

x = x0;

for i=1:N

  y(i) = C * x  +  D * u(i);

  x = (eye(size(A)) - Ts*A) \ (x + Ts*B*u(i));

  hist_x = [hist_x x];

  

end





