For a homework assignment in linear algebra, I have solved the following equation using MATLAB's \
operator (which is the recommended way of doing it):
A = [0.2 0.25; 0.4 0.5; 0.4 0.25]; y = [0.9 1.7 1.2]'; x = A \ y
which produces the following answer:
x = 1.7000 2.0800
For the next part of assignment, I'm supposed to solve the same equation using the least squares approximation (and then compare it against the prior value to see how accurate the approximation is).
How can I find a way of doing that in MATLAB?
Prior work: I have found the function lsqlin
, which seems to be able to solve equations of the above type, but I don't understand which arguments to supply it nor in what order.