function dotq = collision (t, q)
% �Õ“Ë‚Ì‰^“®•û’öŽ®
    global mass;
    global spring;
    global grav;

    x = q(1);
    v = q(2);

    dotx = v;
    if (x <= 0)
        force = -spring * x;
    else
        force = 0;
    end
    dotv = (force - mass*grav)/mass;

    dotq = [dotx; dotv];
end
