help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie : trouble with calculating inverse of a matrix and = inf ???


From: PetrSt
Subject: Re: newbie : trouble with calculating inverse of a matrix and = inf ???
Date: Wed, 24 Apr 2013 01:45:01 -0700 (PDT)

As noted eem2314 above, the problem with inv() is exactly what says the error
message, i.e. (x'*x) is singular. You can overcome it by using pinv()
instead, but you'll got a wrong solution
theta = [0.81818; 0.27273; 2.72727], nevertheless x*theta = [12;15;18].
I think that least squares regression is intended to solve overdetermined
systems, i.e. more equations than unknowns, so if you extend x and y by one
more row (e.g. [1,6,7] and 23, respectively), then
theta = inv(x'*x)*x'*y = [3;1;2] as desired.



--
View this message in context: 
http://octave.1599824.n4.nabble.com/newbie-trouble-with-calculating-inverse-of-a-matrix-and-inf-tp4652204p4652252.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]