Creating an ARMAX model - Do I need a impulse response?

69 Views Asked by At

I'm going to create an ARMAX model:

$$y_k = -a_1y_{k-1} - \dots - a_ny_{k-n} + b_1u_{k-1} + \dots + b_nu_{k-n} = + w_k + c_1w_{k-1} + \dots + c_nw_{k-n}$$

According to my book. I need to find $y_{k}$ from the impulse response:

$$y_k = CA^kx_0 + \sum_{j==0}^{k-1}CA^{k-j-1}Bu_j $$

Where $A, B, C$ are discrete matrices.

Question:

Do I really need to do this way? Can I not simulate a continius time state space model with a for loop and then collect the output $y$ ?

Example:

## simulation
  for k = 1 : urows
    x = A * x  +  B * u(k, :).';
    yk(k, :) = C * x  +  D * u(k, :).';
  endfor

Or do I need to use the formula above?