Finding more than one solution for Matrix Multiplication (Ax = b)
8 ビュー (過去 30 日間)
古いコメントを表示
For some A and b, there are infinite solutions.
Currently, I only know one way to solve for x, which solves for only 1 x. That is, A\b. How do I find more than 1 solution? Is there any I can find specifically 2 solutions?
Thanks, Clark
0 件のコメント
採用された回答
Wayne King
2012 年 9 月 15 日
編集済み: Wayne King
2012 年 9 月 15 日
For example:
A = [1 2; 1 2];
b = [3 3]';
x = pinv(A)*b; % one solution
A*x
% the nullspace of A has dimension 1. So just add that vector
% to the solution to get another solution
y = x+null(A);
A*y % another
Yet another
z = 2*null(A);
w = x+z;
A*w
その他の回答 (3 件)
Clark
2012 年 9 月 15 日
編集済み: Clark
2012 年 9 月 15 日
1 件のコメント
Wayne King
2012 年 9 月 15 日
No, you just use null() on the matrix. null(A) then you get a basis for the nullspace of A, you can add any linear combination of vectors from the nullspace of A to a particular solution and you get a different solution of the linear system
Clark
2012 年 9 月 15 日
1 件のコメント
Wayne King
2012 年 9 月 15 日
All the solutions will be a particular solution plus linear combinations of the nullspace. You can easily write a function that gives you a specified number of linear combinations.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!