1.What is the difference between A\b and linsolve(A,b) (different algorithms?) ?
2.What is the difference solving A*x=b and A'*A*x=A'*b, which is more precise ?
Second equation goes from Least squares approximation
Simple matlab test code:
A=[1,2,3;4,5,6;7,8,9]
b=[1;2;3]
x1= A\b
x1 =
-0.3333
0.6667
0
x2=linsolve(A,b)
x2 =
-0.3333
0.6667
0
x3=linsolve(A'*A,A'*b)
x3 =
0.2487
-0.4974
0.5820
x4=(A'*A)\(A'*b)
x4 =
-0.8182
1.6364
-0.4848
reading linsolve documentation I found that
[X,R] = linsolve(A,B) solves the matrix equation AX = B and returns the reciprocal of the condition number of A if A is a square matrix, and the rank of A otherwise.
so using R we can test precision(2nd question)?