What if you try this:
x1{1} = [.2; .3]; x2{1} = [.3; .4]; x3{1} = [.5; .6]; x4{1} = [.6; .7]; k = 1;
figure
for k = 1:1:50
hold all
scatter(x1{k}(1,1), x1{k}(2,1))
scatter(x2{k}(1,1), x2{k}(2,1));
scatter(x3{k}(1,1), x3{k}(2,1));
scatter(x4{k}(1,1), x4{k}(2,1));
x1{k+1} = (x1{k} + x2{k} + x4{k})/3;
x2{k+1} = (x1{k} + x2{k} + x3{k})/3;
x3{k+1} = (x2{k} + x3{k} + x4{k})/3;
x4{k+1} = (x1{k} + x3{k} + x4{k})/3;
hold off
drawnow
end
First you create a figure, then you force the plot to update with drawnow. You can keep the original "hold on" calls and see what it does as well.
Best Answer