# How do I find the noise for ARMAX model - System identification

A discrete transfer function can be described like this:

$$y[k] = \frac{B(q^{-1})}{F(q^{-1})}u[k]$$

Where can be a polynomal expression: $$B(q^{-1}) = b_0+ b_1q^{-1} + b_2q^{-2} + b_3q^{-3} + \dots + b_nq^{-n}$$ $$F(q^{-1}) = 1+ f_1q^{-1} + f_2q^{-2} + f_3q^{-3} + \dots + f_nq^{-n}$$

Also the shift operator $q^{-1}$ can be rewritten as: $$q^{-1}y(k) = y(k-1), q^{-2}y(k) = y(k-2), q^{-3}y(k) = y(k-3), \dots , q^{-n}y(k) = y(k-n)$$

I hope you understand this. So to do a curve fitting for this transfer function. We can rewrite this:

$$y[k] = \frac{B(q^{-1})}{F(q^{-1})}u[k] = \frac{b_0+ b_1q^{-1} + b_2q^{-2} + b_3q^{-3} + \dots + b_nq^{-n}}{1+ f_1q^{-1} + f_2q^{-2} + f_3q^{-3} + \dots + f_nq^{-n}}u[k]$$

To this:

$$y[k] = [-yq^{-1} - yq^{-2} - yq^{-3} - \dots - yq^{-n} +u+ uq^{-1} + uq^{-2} + uq^{-3} + \dots + uq^{-n}]\begin{bmatrix} f_1\\ f_2\\ f_3\\ \vdots\\ f_n\\ b_0\\ b_1\\ b_2\\ b_3\\ \vdots\\ b_n \end{bmatrix}$$

And even more:

$$y[k] = [-y[k-1] - y[k-2] - y[k-3] - \dots - y[k-n] +u[k]+ u[k-1] + u[k-2] + u[k-3] + \dots + u[k-n]]\begin{bmatrix} f_1\\ f_2\\ f_3\\ \vdots\\ f_n\\ b_0\\ b_1\\ b_2\\ b_3\\ \vdots\\ b_n \end{bmatrix}$$

Now we can solve this by simple MATLAB/Octave command

>> x = A\b


Assumed that $b$ is the $y[k]$ vector and $A$ is the $[-y[k-1] - y[k-2] - y[k-3] - \dots + u[k-n]]$ matrix. Then $x$ will be $f_1, f_2 \dots b_n$.

This is how to estimate a transfer function from know input $u[k]$ and known output $y[k]$. All you need to do is to choose the amount of parameters in the numerator and denominator.

So. Now to my question:

What if I have a ARMAX model insted of a classical transfer function?

$$y[k] = \frac{B(q^{-1})}{A(q^{-1})}u[k] + \frac{C(q^{-1})}{A(q^{-1})}e[k]$$

Where the white noise is $e[k] \sim GWN(0, \sigma^2)$

Here I got to choose three different parameters for $B(q^{-1}), A(q^{-1}), C(q^{-1})$. When I mean parameter, I mean the amount of zeros and poles.

Now to my question:

How do I find $e[k]$? If I know the noise $e[k]$. I can do the same curve fitting again. Just a little bit larger matrix. But Octave handle it!