I'm trying to solve an underdetermined equation (one equation with two unknowns) as a system of the form:
If I solve it with the pseudoinverse, I get
x = pinv(A) * b
x = [0.4, 0.2]'
Which is the least squares solution. So far, so good.
However, if I use mldivide of backslash, I get the following solution.
Which is the sparsest and minimum norm-1 solution. So my question is, how does MATLAB actually calculate this solution?
I've read some other questions, and they just mention that the solution using backslash has at most m nonzero components for an m-by-n matrix A, which is what I'm getting, but they don't say how it's computed.
[Q, R, P] = qr(A)
Q = 1
R = [2, 1]
P = [1, 0;
Which doesn't help much... if I use this, I get the initial solution of least squares. So I guess it's using a different algorithm.