MATLAB: How can i solve this linear system

linear equationMATLABunderdeterminded

Hello,
I have a linear system of equation composed of 14 equations and 49 unknowns. I know that my system can be writed in the Ax=b form and then performing the division A\b to find the unknown vector x. I'm new to Matlab so sorry if I'm asking trivial questions.
My questions are the following:
1) My system should have multiple solutions since it is underdetermined. A\b only gives 1 solution. Is there any way to get more than 1 solution ?
2) I already know that all my 49 unknown are within the range [0;1]. How can I set this constrains to all my unkown ?
3) I may have some unknown that I already know before solving the system. Is it possible to restrict some value of the x vector without having to rewrite the whole system like it is said in the following thread: http://www.mathworks.fr/matlabcentral/answers/17795-basic-matrix-equation-ax-b-with-restrictions
4) Is it possible to import a matrix from a text file, because my A matrix is quite big ?
Regards, Debzz

Best Answer

Your problem is such that there are infinitely many solutions. backslash will return ONE solution, but you want more. How many more? 2? 37? 454233531211 of them?
The general solution can be written in the form
X = X0 + null(A)*k
where k is any general vector, here of size [49-14,1], and X0 is given by
X0 = A\b
If you further require the solution to fall in the 49-dimensional unit box [0,1]^49, it is entirely possible that no solution exists at all. BUT, lsqlin can solve for A solution if any exists. Then you use the same trick that I showed above to find a new solution.
If you don't have the optimization toolbox, so no lsqlin, then you can use lsqnonneg, employing slack variables to transform the problem into one that it can solve. This will require some minor coding of course.
If some of the parameters are already known, then you could simply eliminate them from the problem. Subtract those terms from the right hand side of the linear system. Or, again, if you have lsqlin, then simply set up equality constraints. (This is a far better solution than setting the lower and upper bounds to the same value, which will probably introduce numerical problem.)
And as far as reading in a text matrix, of course MATLAB can read in a file. 14x49 is not even remotely what anyone would call big though.