Take the example of code pasted below.
I just want that the ball move back and forth again and again until some body closes the figure. I used 'while true' loop but it is not useful in this regard.
x = linspace(-1, 1, 75);y = -x.^2;figure(1)for k2 = 1:2 for k1 = 1:length(x) plot(x(k1)*(-1)^k2, y(k1), 'ob', 'MarkerFaceColor','r') axis([min(x) max(x) min(y) max(y)]) refreshdata drawnow endend
Best Answer