If A is a square matrix and A is non-singular (i.e., it's inverse matrix
exist, or its determinant is non-zero), LSQ returns the exact solution to
the linear system.
If A has less than full row rank (underdetermined system of equations),
LSQ returns the solution with the minimum Euclidean length out of an
infinity number of solutions.
If A has less than full column rank (over-determined system of
equations), LSQ returns the "solution" with the minimum residual value
e = A x – b. The system of equations may not have a solution,
therefore, the value returned is not a real solution to the system, just the
one with the smallest residual.
Function LSQ takes as input vector b and matrix A, in that order. Function LSQ
can be found in Function catalog (‚N). Next, we use function LSQ to
repeat the solutions found earlier with the numerical solver:
Square system
Consider the system
with
A
The solution using LSQ is shown next:
2x
1
x
– 3x
1
2x
1
2
3
5
⎡
⎤
⎢
⎥
1
3
8
⎢
⎥
⎢
⎥
2
2
4
⎣
⎦
+ 3x
–5x
= 13,
2
3
+ 8x
= -13,
2
3
– 2x
+ 4x
= -6,
2
3
⎡
⎤
x
1
⎢
⎥
,
x
,
x
⎢
⎥
2
⎢
⎥
x
⎣
⎦
3
13
⎡
⎢
b
13
and
⎢
⎢
6
⎣
⎤
⎥
.
⎥
⎥
⎦
Page 11-25