Least square magnitude solution
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Cesar Cardenas
am 28 Aug. 2022
Kommentiert: Cesar Cardenas
am 28 Aug. 2022
is this a right approach to calculate the least square magnitude x* to this problem? Any help will be greatly appreciated. Thanks
A = [1 2 3 4 5; 6 7 8 9 0];
b = [1;2];
x = lsqr(A,b)
e2 = b - A*x
norm(e2)
0 Kommentare
Akzeptierte Antwort
Torsten
am 28 Aug. 2022
Bearbeitet: Torsten
am 28 Aug. 2022
A = [1 2 3 4 5; 6 7 8 9 0];
b = [1;2];
x = lsqminnorm(A,b).'
norm(x)
norm(A*x.'-b)
if you search for the solution for which x has minimum norm.
If you only search for an arbitrary least-squares solution (i.e. for an x for which norm(e2) is minimum), simply use
x = (A\b).'
norm(x)
norm(A*x.'-b)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Performance and Memory finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!