function indices = zero_crossings(signal,arg)
% Return the indices for the zero crossings. If the second arg
% is 1, we find cases where signal becomes positive, if it is
% -1, we find the cases where the signal becomes negative

index = 1;
for i=2:1:length(signal);
    if ( (sign(signal(i)) ~= sign(signal(i-1))) & (sign(signal(i)) == arg ) )
         indices(index) = i;
         index = index+1;
     end
end