function [f,zc,hpos,hneg]=bouncingball()
    //Modelo continuo
    function dx=f(x,d,t)
        m=1;
        g=9.8;
        k=1e5;
        ba=0.1;
        b=30;
        dx=zeros(x);
        dx(1)=x(2);
        if d(1)>0 then
            dx(2)=(-m*g-ba*x(2))/m;
        else
            dx(2)=(-m*g-b*x(2)-k*x(1))/m;
        end
    endfunction

    //Cruces por cero
    function y=zc(x,d,t)
        y=x(1);
    endfunction

    //Handler positivo
    function [xnew,dnew]=hpos(x,d,t)
        xnew=x;
        dnew=1;
    endfunction
    
    //Handler negativo
    function [xnew,dnew]=hneg(x,d,t)
        xnew=x;
        dnew=0;
    endfunction
 
endfunction
