# Solving non-negative least squares in Matlab (by analogy with least squares)

There is a least-squares problem. It can be solved using backslash in Matlab.
If Ax = b, then x = A \ b.
Let's assume that I have the same problem, but all x must be non-negative (>=0). How can I solve this problem in Matlab by analogy with the previous one (without non-negativity constraints)? I think it can be somehow connected with the active set method.
I know that the non-negative least squares problem can be easily solved with Matlab Optimization toolbox or CVX or in many other ways. But still I'm curious about solving it by analogy with a straight-forward least-squares method (with backslash).