Solving nonlinear set of equation using lsqnonlin

1 view (last 30 days)
I'm writing a code to solve nonlinear set of equations using lsqnonlin. But I'm getting the error: "Nonscalar arrays of function handles are not allowed; use cell arrays instead." I don't know how to go about it. Please help. Attached is the matlab code and required files.

Answers (1)

Matt J
Matt J on 30 Dec 2014
Edited: Matt J on 30 Dec 2014
You cannot generate the different residual terms in the least squares objective with separate functions. A single function, supplied by you, must be used to generate all N residuals. The objective function that you supply must return the residuals in an Nx1 vector.
  2 Comments
Bhavna
Bhavna on 31 Dec 2014
Edited: Bhavna on 31 Dec 2014
Then how else can I solve the same problem?
Matt J
Matt J on 31 Dec 2014
I believe I already told you. Generate the residuals with 1 function, instead of many.

Sign in to comment.

Categories

Find more on Systems of Nonlinear Equations 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!