フィルターのクリア

Computing error for solution to linear equation

1 回表示 (過去 30 日間)
Tevin
Tevin 2022 年 12 月 19 日
編集済み: John D'Errico 2023 年 1 月 8 日
I want to solve a linear equation Ax= b, using least-squares. I also need to find the error in the solution. I am not sure how to find the error.
Error is;
𝐸=‖𝐴𝒙−𝒃‖^2 =Σ𝜃𝑖^2 where i is index counter
A=[2 0;3 1;4 3];
b=[2;3;4];
x= A\b;
I am not sure how to calculate the error. Can someone help me?

採用された回答

Matt J
Matt J 2022 年 12 月 19 日
編集済み: Matt J 2022 年 12 月 19 日
x= A\b;
E=norm(A*x-b)^2
  3 件のコメント
Tevin
Tevin 2023 年 1 月 8 日
Should this actually be E=norm(A*x-b) without the square?
John D'Errico
John D'Errico 2023 年 1 月 8 日
編集済み: John D'Errico 2023 年 1 月 8 日
NO, it should not be.
What was asked for? In your own question, you showed the norm(A*x-b) SQUARED. @Matt J gave you the square of the norm.
It can be whatever you want, but if you want something else, then it is you who needs to make the decision.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by