asol = 
how to get inverse ?
Sie verfolgen jetzt diese Frage
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
Es ist ein Fehler aufgetreten
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Ältere Kommentare anzeigen
0 Stimmen
Teilen Sie einen Link zu dieser Frage
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 Kommentar
Rik
am 17 Aug. 2024
Teilen Sie einen Link zu diesem Kommentar
What exactly is your question? Do you want to find out whether a is equal to aa?
Akzeptierte Antwort
akshatsood
am 17 Aug. 2024
Bearbeitet: akshatsood
am 17 Aug. 2024
0 Stimmen
Teilen Sie einen Link zu dieser Antwort
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 Kommentare
akshatsood
am 17 Aug. 2024
Teilen Sie einen Link zu diesem Kommentar
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
종영
am 17 Aug. 2024
Teilen Sie einen Link zu diesem Kommentar
Can't the size of C be 1x1?
akshatsood
am 17 Aug. 2024
Bearbeitet: akshatsood
am 17 Aug. 2024
Teilen Sie einen Link zu diesem Kommentar
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
am 17 Aug. 2024
Bearbeitet: John D'Errico
am 17 Aug. 2024
Teilen Sie einen Link zu diesem Kommentar
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
am 17 Aug. 2024
Teilen Sie einen Link zu diesem Kommentar
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
am 17 Aug. 2024
Teilen Sie einen Link zu diesem Kommentar
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.
Weitere Antworten (0)
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Tags
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)
