There are two units which implement LM algorithm: lsfit and minlm.
lsfit is a high-level wrapper which solves fitting problem, i.e. minimizes F(c) = (f(c,x[0])-y[0])^2 + ... + (f(c,x[n-1])-y[n-1])^2. It needs a list of points, it automatically passes them one by one to the user-defined function and so on... You probably talk about this unit because this is the only unit which explicitly mentions points and c, x, y arrays. lsfit will work with dummy arrays - you may pass dummy x containing only one element - index of the point, and to fetch data from already calculated array of f's using this index. y, however, must be non-dummy, because its value is used by the algorithm.
minlm unit, from the other side, solves general form minimization problem without any explicit connection with some data to be fitted: min f(c) = f0(c)^2 + ... + fn_1(c)^2. It does not mention x and y, which is exactly the thing you need. Maybe it is better to use minlm in your situation.
|