I have a system of linear equations in the following form. How can I solve it in Matlab?
$$\operatorname*{argmin}_{a,b} \sum_{i,j} [X(i,j)-a\times Y(i,j)-b]^2$$
Where X and Y are known. I need to estimate a and b - which do not depend on (i,j).
I have a system of linear equations in the following form. How can I solve it in Matlab?
$$\operatorname*{argmin}_{a,b} \sum_{i,j} [X(i,j)-a\times Y(i,j)-b]^2$$
Where X and Y are known. I need to estimate a and b - which do not depend on (i,j).
Copyright © 2021 JogjaFile Inc.
Let $A = \begin{bmatrix}Y(1,1) & 1 \\ Y(2,1) & 1 \\ \vdots & \vdots \\ Y(m,n) & 1 \end{bmatrix}$, $y = \begin{bmatrix}X(1,1) \\ X(2,1)\\ \vdots \\ X(m,n)\end{bmatrix}$, and $x = \begin{bmatrix}a \\ b\end{bmatrix}$.
Then, the problem can be rewritten as $\text{argmin}_{x}\|y-Ax\|_2^2$.
This is now the standard linear least squares problem. The solution is $\hat{x} = (A^TA)^{-1}A^Ty$.