
function [arvo,lopetus,suunta] = tapaus(t,x)
% Locate the time when height passes through zero in a 
% decreasing direction and stop integration.
arvo = x(2)-x(1);     % 
lopetus = 1;   % Stop the integration
suunta = 1;   % 