# Untitled

a guest
Feb 6th, 2019
149
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. close all; clear all;
2. N = 7;
3. t_step = 1000;
4. sep = 2.5;
5. mark = '.k';
6. animate = 0;
7.
8. t = linspace(0,2*pi,t_step);
9. T = length(t);
10.
11. circle = zeros(N, T, 2);
12. for i = 1:N
13.   circle(i,:,1) = cos(t*i);
14.   circle(i,:,2) = sin(t*i);
15. end
16.
17. curve = zeros(N, N, T, 2);
18. for i = 1:N
19.   for j = 1:N
20.     curve(i,j,:,1) = circle(i,:,1);
21.     curve(i,j,:,2) = circle(j,:,2);
22.   end
23. end
24.
25. hold on;
26. axis([-1 N*sep+1 -(N*sep+1) 1])
27. axis square
28. set(gca,'visible','off')
29.
30. if animate == 0
31.   for i = 1:N
32.     plot(circle(i,:,1)+sep*i, circle(i,:,2),       mark)
33.     plot(circle(i,:,1),       circle(i,:,2)-sep*i, mark)
34.
35.     for j = 1:N
36.       plot(curve(i,j,:,1)+sep*i, curve(i,j,:,2)-sep*j, mark)
37.     end
38.
39.   end
40. end
41.
42. if animate == 1
43.   for t = 1:T
44.     xbordercirc = zeros(N,1);
45.     ybordercirc = zeros(N,1);
46.     curvecirc = zeros(N,N);
47.
48.     for i = 1:N
49.       plot(circle(i,t,1)+sep*i, circle(i,t,2),     '.k')
50.       plot(circle(i,t,1),     circle(i,t,2)-sep*i, '.k')
51.
52.       xbordercirc(i) = plot(circle(i,t,1)+sep*i, circle(i,t,2),     'ok');
53.       ybordercirc(i) = plot(circle(i,t,1),     circle(i,t,2)-sep*i, 'ok');
54.
55.       for j = 1:N
56.         plot(curve(i,j,t,1)+sep*i, curve(i,j,t,2)-sep*j, '.k')
57.
58.         curvecirc(i,j) = plot(curve(i,j,t,1)+sep*i, curve(i,j,t,2)-sep*j, 'ok');
59.       end
60.
61.     end
62.
63.     pause(0.01)
64.     delete(xbordercirc);
65.     delete(ybordercirc);
66.     delete(curvecirc);
67.   end
68. end
RAW Paste Data