help-octave
[Top][All Lists]

## least square

 From: CYMTR Subject: least square Date: Thu, 05 Aug 1999 15:29:18 -0600 (CST)

```

I ran the following standard example taken from IMSL(and also
checked with Matlab ) for least square solution of Ax = b,
where

octave:4> A = [1,5,15,5;1, 4,17,4 ;1,7,14,7;1,3,18,3;1,1,15,1;\
1,8,11,8;1,3,9,3;1,4,10,0]
A =

1   5  15   5
1   4  17   4
1   7  14   7
1   3  18   3
1   1  15   1
1   8  11   8
1   3   9   3
1   4  10   0

octave:5> b = [30;31;35;29;18;35;20;22]
b =

30
31
35
29
18
35
20
22

octave:6> x = A\b
x =

1.48165
2.59948
1.01204
0.22104

The actual LEAST SQUARE solution for the overdetermines system
( which is ,as I assume, not same as the minimum norm soln for
singular matrices ) is:

X = .636, 2.845, 1.058, 000.
with residuals  r = -.733, .996, -365, 783, -1.353, -.036, 1.306, -.597

Does octave support a linear least square solving code or am I doing
something wrong? ( Mr. David Doolin suggested that I resubmit this ).

Thanking you,

sincerely,

---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure