I need some help with simulating a discrete state space model. I have succeeded to simulate a time continuous state space model via matlab/octave code.
$$\dot{x}(t) = Ax(t)+ Bu(t)\\ y(t) = Cx(t)+Du(t) \\ x(t) = x(t) + \dot{x}(t) \Delta t(t) $$
But how would the update of state $x(t)$ and input $u(t)$ be if the for loop is discrete?
First of all, I have the discrete A and B matrices.
Hint:
Continuous state-space representation: $$\dot{x}(t) = Ax(t)+ Bu(t)\\ y(t) = Cx(t)+Du(t)$$
Discrete state-space representation: $$x(k+1) = A_dx(k)+ B_du(k)\\ y(k) = C_dx(k)+D_du(k)$$
It should be straightforward to calculate your state vector by using your initial conditions.