|MATLAB Function Reference|
Linear least squares with nonnegativity constraints
x = lsqnonneg(C,d)
returns the vector
x that minimizes
norm(C*x-d) subject to
x >= 0.
d must be real.
x = lsqnonneg(C,d,x0)
x0 as the starting point if all
x0 >= 0; otherwise, the default is used. The default start point is the origin (the default is used when
x0==[ ] or when only two input arguments are provided).
x = lsqnonneg(C,d,x0,options)
minimizes with the optimization parameters specified in the structure
options. You can define these parameters using the
lsqnonneg uses these
options structure fields:
||Level of display.
||Termination tolerance on
[x,resnorm] = lsqnonneg(...)
returns the value of the squared 2-norm of the residual:
[x,resnorm,residual] = lsqnonneg(...)
returns the residual,
[x,resnorm,residual,exitflag] = lsqnonneg(...)
returns a value
exitflag that describes the exit condition of lsqnonneg:
||Indicates that the function converged to a solution
||Indicates that the iteration count was exceeded. Increasing the tolerance (
[x,resnorm,residual,exitflag,output] = lsqnonneg(...)
returns a structure
output that contains information about the operation:
||The algorithm used
||The number of iterations taken
[x,resnorm,residual,exitflag,output,lambda] = lsqnonneg(...)
returns the dual vector (Lagrange multipliers)
x(i) is (approximately)
lambda(i) is (approximately)
Compare the unconstrained least squares solution to the
lsqnonneg solution for a 4-by-2 problem:
The solution from
lsqnonneg does not fit as well (has a larger residual), as the least squares solution. However, the nonnegative least squares solution has no negative components.
lsqnonneg uses the algorithm described in . 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 in order to swap out of the basis in exchange for another possible candidate. This continues until
lambda <= 0.
The arithmetic operator
 Lawson, C.L. and R.J. Hanson, Solving Least Squares Problems, Prentice-Hall, 1974, Chapter 23, p. 161.
© 1994-2005 The MathWorks, Inc.