Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Solve nonnegative linear least-squares problem

Solve nonnegative least-squares curve fitting problems of the form

$$\underset{x}{\mathrm{min}}{\Vert C\cdot x-d\Vert}_{2}^{2},\text{where}x\ge 0.$$

`x = lsqnonneg(C,d)`

`x = lsqnonneg(C,d,options)`

`x = lsqnonneg(problem)`

```
[x,resnorm,residual]
= lsqnonneg(___)
```

```
[x,resnorm,residual,exitflag,output]
= lsqnonneg(___)
```

```
[x,resnorm,residual,exitflag,output,lambda]
= lsqnonneg(___)
```

`lsqnonneg`

uses the algorithm described in [1]. The algorithm starts
with a set of possible basis vectors and computes the associated dual
vector `lambda`

. It then selects the basis vector
corresponding to the maximum value in `lambda`

to
swap it out of the basis in exchange for another possible candidate.
This continues until `lambda ≤ 0`

.

[1] Lawson, C. L. and R. J. Hanson. Solving Least-Squares Problems. Upper Saddle River, NJ: Prentice Hall. 1974. Chapter 23, p. 161.

Was this topic helpful?