the loop is not converging it is giving me an infinite value(it is increasing)
Ältere Kommentare anzeigen
clear variables
close all
clc
A = [1 1 2; 1 2 4; 1 2 5];
x = [1; 2; 3];
Error = 0.00001;
Diff= 1;
while Diff>Error
x1=A*x;
Diff=norm(x1-x);
x=x1;
end
1 Kommentar
Mahmoud Chawki
am 20 Mai 2023
Antworten (1)
Why do you think your fixed-point iteration should converge ?
If the absolute values of the eigenvalues of A were all < 1, it would work. But it is not the case:
A = [1 1 2; 1 2 4; 1 2 5];
eig(A)
5 Kommentare
Mahmoud Chawki
am 20 Mai 2023
Verschoben: Matt J
am 20 Mai 2023
Mahmoud Chawki
am 20 Mai 2023
Verschoben: Matt J
am 20 Mai 2023
Mahmoud Chawki
am 20 Mai 2023
Verschoben: Matt J
am 20 Mai 2023
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!