How is the residual in lsqnonlin calculated?

4 views (last 30 days)
Does anyone know how's the residual being calcualted in lsqnonlin function?
I am interested to know the formula.
Is it : res = sum(fun(x).^2) at x?
Where fun is the function you are trying to minimize.
  2 Comments
Torsten
Torsten on 2 Apr 2019
Edited: Torsten on 2 Apr 2019
5th line from above under
But as a user of lsqnonlin, you have to supply the residual vector as
res(i) = f_i(x)
where f_i(x) is the i-th function you want to zeroize.
John D'Errico
John D'Errico on 2 Apr 2019
Exactly. lsqnonlin does not calculate any residual. YOU calculate it, and return that to lsqnonlin, via your objective function.

Sign in to comment.

Answers (0)

Categories

Find more on Linear and Nonlinear Regression in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!