I wanna stop iteration when two matrixes difference approach zero.

2 Ansichten (letzte 30 Tage)
for example,
A=[a;b;c;d;e;f;g;h] %double 7x1
B=[m;n;v;x;z;p;j] %double 7x1
I open while loop for equation and I wanna stop when A-B is equal approximately zero, but it never be zero.
if I write
while A-B~=0
do "........."
infinite loop occuring.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 7 Jun. 2013
tol=0.001
while sum(abs(A-B))>tol
% do
end

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by