Finding more than one solution for Matrix Multiplication (Ax = b)

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

 채택된 답변

Wayne King
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

댓글 수: 1

Ah! Thanks! I was trying to do A\b + null(null(A)) which obviously wasn't working. So, instead, scalar * null(A). Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Wayne King
Wayne King 2012년 9월 15일

0 개 추천

Yes, you can use null() to find a vector from the null space
Clark
Clark 2012년 9월 15일
편집: Clark 2012년 9월 15일

0 개 추천

I don't understand how to use null for this purpose. If I use null(A\b) for example, the answer is simply an empty 1x0 matrix. Could you please elaborate? Sorry, I'm a beginner. I don't see what null would have to do with this. I'm trying to figure out how to use it anyhow.
Thank you.

댓글 수: 1

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
Clark 2012년 9월 15일

0 개 추천

Okay, so, A\b + null(A) gives me another solution.
But, can I find a third solution? I was expecting there may be some function which accepts an argument to return a certain number of solutions.
Thanks.

댓글 수: 1

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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2012년 9월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by