Least square magnitude solution
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
Torsten
2022년 8월 28일
편집: Torsten
2022년 8월 28일
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)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!