I'm using the sgolay function from the Signal Processing toolbox to calculate some derivatives. The function is inside a loop as I feed it different parameters;
[~,g] = sgolay(poly_order, window_length).
However, it seems like for all or almost all of the iterations, I'm getting the warning
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.820809e-39.
> In sgolay (line 114)
where RCOND is not quite the same value each time. Line 114 in the function is
I have a basic understanding of the error; the / command computes an inverse of a matrix, and the matrix cannot easily be inverted. However, I don't know what I can do differently to remove this warning. Can anyone help?