Why do I get an error when I use the GAMMAINC function with complex input in MATLAB 7.8 (R2009a)?
조회 수: 2 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2009년 6월 27일
편집: MathWorks Support Team
2021년 11월 4일
I am trying to use the GAMMAINC function with complex input but receive an error. In MATLAB 7.7 (R2008b) I received a different output.
Reproduction steps:The GAMMAINC command behaves differently in MATLAB 7.7 (R2008b) and MATLAB 7.8 (R2009a):
In MATLAB 7.8 (R2009a) when running the following code:
gammainc(2+5i,2)
I receive the following error:
ERROR: ??? Error using ==> gammainc
Inputs must be real, full, and double or
single.
In MATLAB 7.7 (R2008b) I got the following results:
ans =
1
채택된 답변
MathWorks Support Team
2021년 10월 18일
편집: MathWorks Support Team
2021년 10월 18일
This is the expected behavior in MATLAB 7.8 (R2009a).
As per the documentation for the GAMMAINC function in MATLAB 7.8 (R2009a) , the function is not intended to work with complex inputs. The fact that that worked in MATLAB 7.7 (R2008b) was unintentional. In the latest version of MATLAB, hard error checking has been added and the error message is intended.
In earlier versions if you were getting answers that were satisfactory, a workaround would be to make a local copy of the code from the earlier version. However, note that this is not supported.
댓글 수: 0
추가 답변 (1개)
Karan Gill
2016년 4월 28일
편집: MathWorks Support Team
2021년 11월 4일
If you have the Symbolic Math Toolbox, use igamma.
>> igamma(1,1+1i) ans = 0.1988 - 0.3096i
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!