function [f,zc,H]=bball2D()
    function dx=f(x,d,t)
       m=1;
       b=30;
       k=100000;
       g=9.8;
       bx=0.1;
       dx=[x(2);1/m*(-m*g-d(1)*(b*x(2)+k*x(1)));x(4);1/m*(-bx*x(4)-d(2)*(b*x(4)+k*x(3)))];
    endfunction

    function z=zc(x,d,t)
        z=[x(1);x(3)];
    endfunction
    
    function [x,d]=H(x,d,t,sig,ind)
        //sig=1 says that zc crosses to a positive value
        //sig=-1 ...
        if sig>0 then
            d(ind)=0;
        else
            d(ind)=1;
        end
    endfunction
      
endfunction
