From: matlab_learner on
i have r = -1;
then i do:
r = max(abs(-(1/(h)^2) * ( fi(i-1) - 2 * fi(i))),r)

what does the above do?

is it comparing the new value of r to the old value of r (which is
-1)?

tis matlab. tnx.
From: Matt Fig on
Sometimes it is just as easy to try it for yourself and figure it out.

r = -1;

max(0,r)
max(1,r)
max(2,r)
max(-2,r)
max(-3,r)
max(-4,r)


See the pattern? Also,

help max

would probably let you know just as quick.
From: matlab_learner on
actually working in 2D and its not returning good value so that is the
origin of question. here take a look:

r is in 2D...need to trim it down so i can compare it correct and
return a single value:

r=-1;
for i = 2:M-1
for j = 2:M-1
r = max(abs(1/(dt*h)*(u(i,j)-u(i-1,j)+v(i,j)-
v(i,j-1))-(1/(h)^2) * ( fi(i+1,j) - 4*fi(i,j) +fi(i-1,j)+fi(i,j
+1)+fi(i,j-1))),r) ;
end
end

i am pretty sure of the expression....so if u can check the computer
science (matlab ) side i would b grateful. tnx.