Documentation

### This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

# Nonlinear Least Squares (Curve Fitting)

Solve nonlinear least-squares (curve-fitting) problems in serial or parallel

Nonlinear least-squares solves min(∑||F(xi) - yi2||), where F(xi) is a nonlinear function and yi is data. See Nonlinear Least Squares (Curve Fitting). For problem setup, see Solver-Based Optimization Problem Setup.

## Functions

 `lsqcurvefit` Solve nonlinear curve-fitting (data-fitting) problems in least-squares sense `lsqnonlin` Solve nonlinear least-squares (nonlinear data-fitting) problems

## Topics

### Nonlinear Least Squares Solutions

Nonlinear Data-Fitting

Basic example showing several ways to solve a data-fitting problem.

Banana Function Minimization

Shows how to solve for the minimum of Rosenbrock's function using different solvers, with or without gradients.

Example of fitting a simulated model.

Nonlinear Least Squares With and Without Jacobian

Example showing the use of analytic derivatives in nonlinear least squares.

Nonlinear Curve Fitting with lsqcurvefit

Example showing how to do nonlinear data-fitting with lsqcurvefit.

Fit an Ordinary Differential Equation (ODE)

Example showing how to fit parameters of an ODE to data, or fit parameters of a curve to the solution of an ODE.

Fit a Model to Complex-Valued Data

Example showing how to solve a nonlinear least-squares problem that has complex-valued data.

### Parallel Computing

What Is Parallel Computing in Optimization Toolbox?

Using multiple processors for optimization.

Using Parallel Computing in Optimization Toolbox

Improving Performance with Parallel Computing

Considerations for speeding optimizations.

### Algorithms and Options

Least-Squares (Model Fitting) Algorithms

Minimizing a sum of squares in n dimensions with only bound or linear constraints.

Optimization Options Reference

Describes optimization options.

Watch now