What is the input dimension for LMS update algorithm I just realized this forum existed, posted my question on the wrong forum.
Sorry about the formatting, please don't hesitate to ask if any part of this post is unclear. This is my first post.
I'm trying to implement a simulation of an ANC system with python, using this model here, but that's not the main point. My simulation keeps diverging, so I'm trying to figure out if it's my system is unstable or did I implement the NLMS algorithm wrong. Below is my code for the NLMS update. I'm using a source from Mathworks here.
x is input vector--------------------------------------------dimension(N * 1)
error is (desired vector - NLMS prediction)---------dimension(N * 1)
w_prev is the previous iteration's weight vector---dimension(1 * m)
def lms_update(x,error,w_prev,mu):

    ep = 0

    w_prev = np.array(w_prev)
    error = np.array(error)

    x_normal = np.dot(np.conjugate(x),np.linalg.inv((ep+np.dot(np.transpose(np.conjugate(x)),x))))


    w_update = w_prev + 2*mu*np.dot(error,x_normal)
    w_update = w_update.tolist()

    return w_update

then from above dimensions, after applying the update formula,
w(n)=αw(n−1)+f(u(n),e(n),μ)  and  f(u(n),e(n),μ)=μe(n)u'(n)
the update would be a 1 * 1 constant, and the weight would all be updated with the same value, which doesn't make too much sense to me.
So I adjust the input vector x into a (N * m) matrix, using vectors from current and previous iterations, so I can get the update to be a (1 * m) matrix. But I'm not sure if this is the correct way. From what I gathered from papers and google searches, nothing pops up indicating dimensions of the input. But I did implement a gradient descent algorithm before which input is a matrix, not a vector.
The output of an FIR filter is
$$
y(n) = \sum_{i=0}^{N-1}w_i(n)x(n-i)
$$
Say the weight vector $\mathbf{w}(n)$ has a length of $N$, i.e.,
$$\mathbf{w}(n) = [w_0(n), w_1(n), \ldots, w_{N-1}(n)]^T$$
and the input vector $\mathbf{x}(n)$ should have the same length as $\mathbf{w}(n)$:
$$\mathbf{x}(n) = [x(n), x(n-1), \ldots, x(n-N+1)]^T$$
Therefore the output $y(n)=\mathbf{w}^T(n)\mathbf{x}(n)$ is a scalar, and the error signal $e(n)$ and disired signal $d(n)$ are also scalar. They represent the signals at discrete time $n$. You should update the filter weights sample by sample.