Solving matrix with some known column values
14 views (last 30 days)
Show older comments
I have a system of linear equations Ax = B where B is completely known and x and A are partially known. For the known values of x, the corresponding diagonal entry in A is unknown (although I consider these dummy variables in A that I'm not interested in, just there to make the math work). Is there a Matlab routine to solve for the unknown x values? I'm not so familiar with linear algebra techniques.
0 Comments
Accepted Answer
Roger Stafford
on 29 May 2017
Edited: Roger Stafford
on 29 May 2017
By your assumption, for any i for which x(i) is already known, the corresponding coefficient A(i,i) will be unknown, while all A(j,i)*x(i) with j not equal to i will be known. Suppose we perform the following changes to your three arrays A, x, and B:
1) Give A(i,i) the known value x(i).
2) Consider x(i) as now the previously unknown value A(i,i).
3) For each j ~= i, subtract the known value A(j,i)*x(i) from B(j) and replace A(j,i) with zero.
I claim that the resulting set of linear equations will be entirely equivalent to the previous set, since we have only performed valid algebraic transformations on the equations. Therefore, if we repeat this action for each of the known values of x(i), we arrive at new arrays A, x, and B whose solution is the same as that of the original arrays, and all values in the new A are known while all values in x are unknown, and we can solve them by the ordinary methods for A*x = B, namely x = A\B.
I am confident that matlab does not have any single function which performs the above actions, but obviously they can be made by appropriate for-loops, and I leave that task to you, Ryan.
Note that you will get solutions for the unknown A(i,i) values even though you do not intend to.
More Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!