The methodology outlined in the image attached may not be the most suitable one for this case. The recommended way to solve the system of equations given above may be to use the “mldivide” operator in MATLAB. So, the matrix may be calculated as
But using the above methods yields the following warning message
‘Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.202823e-18’.
One possible work-around in this case is to use the pseudo-inverse of A. The following code may be used to compute “x”
which gives
x = -1.0556 -2.5556 -4.0556
0.1111 0.1111 0.1111
1.2778 2.7778 4.2778
Please refer to the following documentation link on “pinv” to get further clarification on calculating pseudo-inverse.
1 Comment
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/504703-for-loop-for-system-of-equations#comment_795715
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/504703-for-loop-for-system-of-equations#comment_795715
Sign in to comment.