Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f[pts_, S_] := (
- M = Length[pts];
- new = ConstantArray[0, M];
- vec = pts;
- A = SparseArray[{{M, 1} -> 1, {i_, i_} -> 1, {i_, j_} /; j - i == 1 -> 1}, {M, M}];
- For[s = 1, s <= S, s++,
- new = A.vec/2;
- vec = new;];
- vec = Standardize[vec];
- vec = Append[vec, vec[[1]]];
- ListPlot[{vec, vec}, Joined -> {True, False}, AspectRatio -> 1, Axes -> False])
- M = 75;
- max = 3 M Sqrt[M];
- step = Ceiling[max/200];
- pts = RandomReal[1, {M, 2}];
- ListAnimate[Table[f[pts, S], {S, 1, max, step}]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement