function g = inaxis(f)
ax = axis;
    function gx = fun(t,x)
        gx = f(t,x);
        mask = (x(1,:)>ax(1)) & (x(1,:)<ax(2)) & (x(2,:)>ax(3)) & (x(2,:)<ax(4));
        gx = gx.*repmat(mask,2,1);
    end
    g = @fun;
end