Debora In your loop "for i=1:w" you call figure(1). Not sure what that does in a loop, but it might blow away any prior plot from a prior iteration of the loop. Other than that I don't see any reason why it wouldn't plot, though it's inefficient since you're plotting the whole array each time as you make it (add an additional point). If you want to do it that way, perhaps as an animation, you'll need to add a "drawnow" after the call to plot(). Otherwise, just call plot after loop is all done.
Maybe next time you might consider asking in the Answers forum instead of the newsgroup.