I was looking for a function to determine baseline of xy chart. I found some codes that was written in python.
Ex: Python baseline correction library
def baseline_als(y, lam, p, niter=10):
L = len(y)
D = sparse.csc_matrix(np.diff(np.eye(L), 2))
w = np.ones(L)
for i in xrange(niter):
W = sparse.spdiags(w, 0, L, L)
Z = W + lam * D.dot(D.transpose())
z = spsolve(Z, w*y)
w = p * (y > z) + (1-p) * (y < z)
return z
But I don't know how to convert it to C# the result of this code is used to remove the baseline like the following image
This code is based on "Asymmetric Least Squares Smoothing" algorithm by P. Eilers and H. Boelens
If you know any library or sample code for algorithms like "Asymmetric Least Squares Smoothing", please share with me