MATLAB: Finite difference using iterative method, help with while loop convergence

convergancewhile loop

Here is my code, it seems to do only one iteration.
clc;
clear all;
%Define Variables
T1=100; T2=100; T3=100; T4=100;
%Equations and Residuals
R1=[abs(500+400+100+T2-(4*T1))]; R2=[abs(500+100+T1+T3-(4*T2))]; R3=[abs(500+100+T2+T4-(4*T3))]; R4=[abs(500+100+(2*T3)-(4*T4))]; Rt=[R1 R2 R3 R4];
while Rt> 0.1 %Repeat until all residuals converge less than 0.1
Rt(1)=[abs(500+400+100+T2-(4*T1))]; Rt(2)=[abs(500+100+T1+T3-(4*T2))]; Rt(3)=[abs(500+100+T2+T4-(4*T3))]; Rt(4)=[abs(500+100+(2*T3)-(4*T4))];
Rm=max(Rt); %Identify the largest residual (abs(max) vs abs(min))
if Rt(1)==Rm %Find the corresponding index and change the temperature
T1=(500+400+100+T2)/4;
elseif Rt(2)==Rm
T2=(500+100+T1+T3)/4;
elseif Rt(3)==Rm
T3=(500+100+T2+T4)/4;
else Rt(4)==Rm
T4=(500+100+(2*T3))/4;
end
end
Rt

Best Answer

I actually figured out my own problem, in my while statement I was using an array, thus I had to use the any function to make sure each element in the array met the requirements.
ie--- while any(Rt> 0.1)