My matrix isn't showing properly in the pcolor plot

1 view (last 30 days)
So I am making a program to simulate deposition of a material on a surface. I was testing it and a problem appeared in the display: on the borders of the surface the condition is different from the rest, but the same for them:
if p==1
a=0;
b=0;
for i=1:npontos
a=a+O(i,p);
b=b+O(i,p+1);
end
if a<=b
O(a+1,p)=1;
else
O(b+1,p+1)=1;
end
this makes it build in a way that if p is allways equal to 1 the result over a period of time (handled by the rest of the program) is two columns formed, on p=1 and on p=1+1=2
I repeated the code for p=100 (other border):
elseif p==100
a=0;
b=0;
for i=1:npontos
a=a+O(i,p);
b=b+O(i,p-1);
end
if a<=b
O(a+1,p)=1;
else
O(b+1,p-1)=1;
the result should be two columns, one in p=99 and the other on p=100, but in this case the column only shows buildind on p=100, despite the fact that the matrix shows that there should be a column in p=99.
Does anyone know what causes this?
Funny thing if I change the border to 99 is works properly.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!