function y=mod360(x)

y = rem( x, 360 );
ii = find( y < 0 );
if ~isempty( ii )
    y(ii) = y(ii) + 360;
end
