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์ผ

0 ๊ฐœ ์ถ”์ฒœ

x= A\b;
E=norm(A*x-b)^2

๋Œ“๊ธ€ ์ˆ˜: 3

Matt J
Matt J 2022๋…„ 12์›” 19์ผ
No, did you try it?
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๊ฐœ)

์นดํ…Œ๊ณ ๋ฆฌ

๋„์›€๋ง ์„ผํ„ฐ ๋ฐ File Exchange์—์„œ Eigenvalue Problems์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

์งˆ๋ฌธ:

2022๋…„ 12์›” 19์ผ

ํŽธ์ง‘:

2023๋…„ 1์›” 8์ผ

Community Treasure Hunt

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

Start Hunting!

Translated by