I've been able to make a circle move inside a rectangle with this code:
if (r(2)+R >=b) r(2)=b-R; v(2)=-v(2) end plot(r(1)+R*x,r(2)+R*y,'-b','MarkerSize',28*R) rectangle('Position',[0,0,a,b]) axis equal pause(dt/deltat) end
how do I do the same thing, but with n circles?
Best Answer