Making Particles Move Randomly Within A Circle [closed]
I am attempting to make plotted points move around within a circle of a known radius and center. At the moment I am able to generate points within the boundary, but now I need to make them move. I have the following script to generate the initial locations of the particles. function [particle_gen] = generate(n,centre,radius) %generates n particles in a circle with specified centre and radius angle = 2 * pi * rand(n,1); r = radius * sqrt(rand(n,1)); X = r.*cos(angle) + centre(1); Y = r.*sin(angle) + centre(2); plot(X,Y,'.k') end I want to animate them so that the particles travel in a straight