how to write a code for a variant of Newton's method in calculating square root of a matrix?
Show older comments
Hello there, I have a question regarding a variant of Newton's method in calculating square root of a matrix. here is how the method works:
X_0=A+I,
X_{k+1}=(1/2)*(x_{k}+(x_{k}^(-1)*(A+(I/(k+1)))))
and here is the code I wrote:
A = [1 5;2 3];
I=eye(2);
for k = 0:1:10;
x0= A+I;
x1=(1/2)*(x0+(x0^(-1)*(A+(I/(k+1)))))
end
the problem is my indexing, I do not know how to write the code in a way that the calculation will continue with each time substituting the new X_{k} in the pervious formula.
Thank you for your time and attention,
Ha
Accepted Answer
More Answers (0)
Categories
Find more on Debugging and Improving Code in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!