function y = cotangent(z) %COT Cotangent. % COT(X) is the cotangent of the elements of X. % % removes a bug in MATLAB Version 6.5.0.180913a (R13) large = 20; y = z; k1 = find(abs(imag(z)) > large); k2 = find(abs(imag(z)) <= large); y(k2) = 1./tan(z(k2)); y(k1) = -i*sign(imag(z(k1))); return