asol = 
how to get inverse ?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
a = [1 2 3];
b = [3 2 1 ].';
c = a*b;
aa = c*pinv(b) ;
i want to answer a = aa but i can't
pleas~~~~
댓글 수: 1
Rik
2024년 8월 17일
What exactly is your question? Do you want to find out whether a is equal to aa?
채택된 답변
akshatsood
2024년 8월 17일
편집: akshatsood
2024년 8월 17일
0 개 추천
Dear @종영
I understand that you are trying to recover the original vector "a" from matrix multiplication. The issue here is that "c" is a scalar, so when you multiply "c" by pseudo-inverse of "b", you do not necessarily get back the original vector "a".
Explanation: The operation "c * pinv(b)" gives you a vector that tries to approximate "a" under the least-squares solution, but it woould not necessarily equal "a" unless certain conditions are met (e.g., "b" is orthogonal).
Solution: To directly recover "a", you need more information than just "c" and "b". However, if you have control over the process, you can ensure that "b" is orthogonal or use other constraints to make this recovery possible. However, without additional information or constraints, "a" cannot be reconstructed from "c * pinv(b)" operation.
I hope this helps.
댓글 수: 6
akshatsood
2024년 8월 17일
In order to recover the vector "a", the following code should work
a = [1 2 3]; % Original row vector
b = [3 2 1].'; % Column vector
% Create a matrix using the outer product
C = a.' * b.'; % This results in a 3x3 matrix
% Recover 'a' using the pseudo-inverse
aa = round(C * pinv(b.')).'; % This should recover 'a'
% Display the results
disp('Original vector a:');
Original vector a:
disp(a);
1 2 3
disp('Recovered vector aa:');
Recovered vector aa:
disp(aa);
1 2 3
종영
2024년 8월 17일
Can't the size of C be 1x1?
akshatsood
2024년 8월 17일
편집: akshatsood
2024년 8월 17일
Dear @종영
When "c" is a Scalar:
- "c = a * b" is a scalar resulting from the dot product of "a" and "b".
- "aa = c * pinv(b)" attempts to reconstruct "a" from the scalar "c" and the pseudo-inverse of "b".
Why it Fails:
- The scalar "c" does not contain enough information to reconstruct the vector "a".
- The pseudo-inverse of a vector "b" is a generalized inverse that does not guarantee the reconstruction of the original vector a when multiplied by a scalar.
When "c" is a Matrix:
- c = a.' * b.' results in a matrix (a 3x3 matrix in this answer).
- aa = round(C * pinv(b.')).' attempts to reconstruct "a".
Why it Works:
- The outer product "c" is a full-rank matrix that captures more information about the relationship between "a" and "b".
- The pseudo-inverse operation on b.' (a row vector) can be used to reconstruct "a" when "c" is multiplied by it. This is because the matrix "c" retains the linear transformations needed to recover "a".
I hope this helps.
John D'Errico
2024년 8월 17일
편집: John D'Errico
2024년 8월 17일
You already have a good and fairly complete answer. But let me expand on a few points.
a = [1 2 3];
b = [3 2 1 ].';
c = a*b
c = 10
And as said, there is too little information to reconstruct a from only one piece of information, the constant c. With c == 10, are there other vectors x, such that x*b == 10. In fact, there are infinitely many such vectors. The simplest one is one you will get from pinv, or from lsqminnorm.
a0 = c*pinv(b)
a0 = 1x3
2.1429 1.4286 0.7143
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
a0*b
ans = 10.0000
As you should see, it does correctly return 10 as the result. But it is not the vector you wanted. Since there are infinitely many such possible vectors, what can you expect?
The complete set of all possible solutions can be written as:
syms s t
asol = vpa(c*pinv(b) + [s,t]*sym(null(b.').'),5)
And for some choice of s and t, you would have gotten the vector [1 2 3]. But ANY choice of s and t will still work.
vpa(asol*b,5)
ans = 
I've used only 5 digits here to make it all readable, but do you follow the idea? Had I allowed more precision than only 5 digits, ANY choice of s and t will work.
The one generated by pinv happens to be where s=t=0. (That is essentially by design.) But we can learn what it will take to generate the solution you think was correct.
st = solve(asol(1) == 1,asol(2) == 2,[s,t])
st = struct with fields:
s: 0.91047194823962383245670176555592
t: 2.4552359741203088219207249743343
subs(asol,st)
ans = 
and within some tiny amount of crap (remember, I truncated everything to 5 digits there to make it all readable) you get the result you wanted, for that specific choice of s and t.
Steven Lord
2024년 8월 17일
With c == 10, are there other vectors x, such that x*b == 10. In fact, there are infinitely many such vectors. The simplest one is one you will get from pinv, or from lsqminnorm.
The simplest in some sense. But as you said, there are others.
a = [1 2 3];
b = [3 2 1 ].';
c = a*b
c = 10
alsoc = [0 0 10]*b
alsoc = 10
alsoc2 = [0 5 0]*b
alsoc2 = 10
alsoc3 = [3 0 1]*b
alsoc3 = 10
If you didn't know a, how could you rule out that a is [0 0 10], [0 5 0], or [3 0 1] instead of [1 2 3]? Either of the vectors used to create alsoc or alsoc2 could be considered "simpler" as they only have one non-zero element, as does the solution returned by \.
a2 = 10/b
a2 = 1x3
3.3333 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
a2*b
ans = 10
John D'Errico
2024년 8월 17일
Yes, I guess my use of simplest as a description is arguable. Certainly
a = [10/3, 0, 0]
a = [0 0 10]
a = [0 5 0]
or
a = [10/6, 10/6, 10/6]
Would as easily qualify, and are surely simpler by most definitions of the word. They all work as well as any other.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
