Can you explain me the difference between lsq(A,b) and A\b? Why do I get a positif solution when I use lsq(A,b,1)? Where can I get the source code of lsq function?
There should be no difference when $Ax=b$ has a unique solution. The differences arise when the system is underdetermined or inconsistent.
If $Ax=b$ has multiple solutions,
If there are no exact solutions,
However, the algorithm of
Depends on your $A$ and $b$. For example,
Scilab source code is available. Also, Scilab documentation says that the
I though A\b is using the LU approach. This is my opinion, may be there are slight different in the result since A\b use direct method, while lsq is using approximation via least square