Before you begin to solve an optimization problem, you must choose the appropriate approach: problem-based or solver-based. For details, see First Choose Problem-Based or Solver-Based Approach.
Nonlinear least-squares solves min(∑||F(xi) - yi||2), where F(xi) is a nonlinear function and yi is data. See Nonlinear Least Squares (Curve Fitting).
For the problem-based approach, create problem variables, and then
represent the objective function and constraints in terms of these
symbolic variables. For the problem-based steps to take, see Problem-Based Optimization Workflow. To
solve the resulting problem, use
For the solver-based steps to take, including defining the objective
function and constraints, and choosing the appropriate solver, see Solver-Based Optimization Problem Setup. To solve
the resulting problem, use
|Optimize||Optimize or solve equations in the Live Editor|
Basic example of nonlinear least squares using the problem-based approach.
Solve a least-squares fitting problem using different solvers and different approaches to linear parameters.
Fit parameters on an ODE using problem-based least squares.
Basic example showing several ways to solve a data-fitting problem.
Shows how to solve for the minimum of Rosenbrock's function using different solvers, with or without gradients.
Example of fitting a simulated model.
Example showing the use of analytic derivatives in nonlinear least squares.
Example showing how to do nonlinear data-fitting with lsqcurvefit.
Example showing how to fit parameters of an ODE to data, or fit parameters of a curve to the solution of an ODE.
Example showing how to solve a nonlinear least-squares problem that has complex-valued data.
Prerequisites to generate C code for nonlinear least squares.
Example of code generation for nonlinear least squares.
Explore techniques for handling real-time requirements in generated code.
Use multiple processors for optimization.
Perform gradient estimation in parallel.
Investigate factors for speeding optimizations.
Syntax rules for problem-based least squares.
Minimizing a sum of squares in n dimensions with only bound or linear constraints.
Explore optimization options.