I have n pairs of $n\times 1$ vectors $x$ and $b$. How can I find an $n\times n$ matrix A which satisfies $Ax=b$ for all the n pairs of vectors $x$ and $b$? I am using matlab, is there a build in function? What if I have more then n pairs of vectors, is there a way to get a best fit $n\times n$ matrix?
Let me rephrase the question alittle: I can produce many measurements of pairs of vectors x and b with a computer program. I know there exist a matrix A such that Ax=b for all these pairs (From physical theory). But there is some uncertainty in x and b. So how can I find this matrix? How many pairs do I need? Also the elements of each vector x sum to 0.
If the (column) vectors $x_{1}, \dots, x_{n}$ are linearly independent, put them in a matrix $$ X = \begin{bmatrix} x_{1} & \dots & x_{n} \end{bmatrix}, $$ which will be then invertible. Do the same for the $b_{i}$ $$ B = \begin{bmatrix} b_{1} & \dots & b_{n} \end{bmatrix}, $$ so that you have $$ A X = B, $$ and then $$ A = B X^{-1}. $$
If the $x_{i}$ are not independent, the task may be impossible (for instance when $x_{1} = x_{2}$ but $b_{1} \ne b_{2}$), or the solution might not be unique.