function lsr(m, n, data_n, anim_n) % LSR Animation of a cycle of the Lissajous Figures (§QÂĦp¹Ï§Î) % Usage: LSR(M, N, DATA_N) % M: sin(M*t); % N: cos(N*t); % DATA_N: No. of data points in a cycle % Roger Jang, Nov 23, 1996 if nargin<1, m = 3; end if nargin<2, n = 4; end if nargin<3, data_n = 10001; end if nargin<4, anim_n = 10000; end t = linspace(0, 10*pi, data_n); x = cos(m*t); y = sin(n*t); h = plot(x, y, 'y'); set(h, 'linewidth', 3); axis image; h = line(nan, nan, 'marker', 'o', 'color', 'c', 'erasemode', 'xor', 'markersize', 10, 'linewidth', 3); %for i = 1:anim_n, % set(h, 'xdata', x(rem(i, data_n)+1), 'ydata', y(rem(i, data_n)+1)); % drawnow %end comet(x, y, 0.02);