clear
n = 100;
d = 2*n;
x  = zeros(1,d);
xd = zeros(1,d);

x(1) = 1;
ns = 2000;     % number of time steps per frame
nf = 5000;     % number of frames
dt = .00005;
ph = .25;   %  height of max x, for plotting

for frame = 1:nf
    for step = 1:ns
        x = x + dt*fsim(x);
    end
    plot(x(1,1:n),'o-')
    tl = sprintf('%4d masses, frame %5d',n,frame);
    title(tl)
    axis([1 n -ph ph])
    grid
    pause(.005)
end
 
