Question: how to use lsqnonlin in matlab?
Answer: x = lsqnonlin( fun , x0 ) starts at the point x0 and finds a minimum of the sum of squares of the functions described in fun . The function fun should return a vector (or array) of values and not the sum of squares of the values. (The algorithm implicitly computes the sum of squares of the components of fun(x) .)