Contents Previous Next Subchapters Current Chapters-> interp interp1 lagrange polyfit smospl cubespl cubeval interp2 mlmode_interp2 snewton brent linlsq linlsqb nlsq dnlsq nlsqbox dnlsqb conjdir neldermead conjgrad minline lemke Qpos Qbox Qpro sqp relative fordiff cendiff autodiff testder testgrad testhess Parent Chapters-> Omatrix6 fit linlsq Search Tools-> contents reference index search

Singular Linear Least Squares
 Syntax `linlsq(`A`, `b`, `bound`)` See Also nlsq , linlsqb

Description
Returns a vector `x`, that solves the problem ```                           2      minimize | A x - b |  with respect to x ```The matrix A is real, double-precision, or complex, b is a column vector with the same type and row dimension as A, and bound is a scalar with the same type as A such that absolute singular values of the matrix A that are less than bound are replaced by 0 before solving the minimization problem. If A is not complex, bound must have the same type as A. If A is complex, bound must be double-precision. The returned vector, `x`, has the same type as A. ``` ```If more than one solution exists, the solution of minimum norm is returned (i.e., the value of `x` that minimizes `|x|` over the set of solutions). ``` ```The operation "`\`" uses a QR factorization to solve similar problems. If the rank of A is less than both its row and column dimension, the "`\`" operator will generate an error if you compute `A \ b`. The `linlsq` function can solve such problems.

Example ```      A   = {1., 1.}      b   = {1., 2.}      eps = 1e-7       linlsq(A, b, eps) ``` returns ```      1.5 ```