Solves linearly constrained linear least-squares problems.

lsqlin(A, b, C, d, tol = 1e-13)

Arguments

A

nxm-matrix defining the least-squares problem.

b

vector or colum matrix with n rows; when it has more than one column it describes several least-squares problems.

C

pxm-matrix for the constraint system.

d

vector or px1-matrix, right hand side for the constraints.

tol

tolerance to be passed to pinv.

Details

lsqlin(A, b, C, d) minimizes ||A*x - b|| (i.e., in the least-squares sense) subject to C*x = d.

Value

Returns a least-squares solution as column vector, or a matrix of solutions in the columns if b is a matrix with several columns.

Note

The Matlab function lsqlin solves a more general problem, allowing additional linear inequalities and bound constraints. In pracma this task is solved applying function lsqlincon.

Author

HwB email: <hwborchers@googlemail.com>

References

Trefethen, L. N., and D. Bau III. (1997). Numerical Linear Algebra. SIAM, Society for Industrial and Applied Mathematics, Philadelphia.

See also

Examples