function twomasses1()
%Minimal code.  Not good enough to hand in.
p.m  = [1 1]';  p.k  = .5;     
p.L0 = 3;       p.F0 = 1;      

tspan = linspace(-1,10,101); 
z0    = [0 p.L0 0 0]' ;

[t zarray] = ode23(@rhs,tspan, z0,[],p);

x1 = zarray(:,1);   x2 = zarray(:,2);
x1= x1 - x1(1);     x2 = x2-x2(1); 

plot(t,x1, t,x2) 
end


function zdot =rhs(t,z,p)
x=z(1:2); v=z(3:4);

F=0;
if t>=0, F=p.F0; else F=0;  end


T = p.k*(x(2)-x(1) - p.L0); 

  xdot = v;   
  vdot = [ T  (-T+F) ]'./ p.m;    

zdot = [xdot;vdot];
end
