%This function plots pendulum wave motion as seen from the top view.
%
% n is the number of pendulums, f is the frequency of the first pendulum
% in the wave, df is the incremental change in frequency between pendulums
% (added), t is the time to display the animation

%set initial time to zero.
t_n=0;

%preallocate lengths of matrices.
y=(1:n);
x=(1:n);

while (t>t_n)

%for each value in x,y matrices, populate with value at current t.
for j=1:n
x(j)=j;
y(j)=sin(2*pi*(f+(j)*df)*t_n+pi/2);
end