Logarithm of complex sine and cosine avoiding overflow

버전 (2.27 KB) 작성자: David Young
Functions to compute log(sin(Z)) and log(cos(Z)) avoiding overflow for large abs(imag(Z)).

다운로드 수: 170

업데이트 날짜: 2011/9/19

라이선스 보기

log(cos(Z)) and log(sin(Z)) return infinities for abs(imag(Z)) > 711 in double precision, or abs(imag(Z)) > 90 in single precision. The overflow occurs in the trigonometric function; the correct final result has about the same magnitude as Z, and can be readily computed.

Using logcos(Z) or logsin(Z) instead of log(cos(Z)) or log(sin(Z)) respectively avoids the overflow, greatly extending the range of arguments which give a useful result.

The functions exploit a simple approximation; this is only applied when the approximation error is less than the precision to which numbers can be represented, so there is no loss of accuracy. Both single and double precision computation are supported.

Note that there is no point in using these functions when computing with real numbers, or with complex numbers if it is known that the imaginary part is close to zero.

인용 양식

David Young (2023). Logarithm of complex sine and cosine avoiding overflow (https://www.mathworks.com/matlabcentral/fileexchange/32947-logarithm-of-complex-sine-and-cosine-avoiding-overflow), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2011a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
Help CenterMATLAB Answers에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보