log2(0)=-inf problem
조회 수: 5 (최근 30일)
이전 댓글 표시
Hallo,
my problem is that i want to set the quantity log2(0), so as log2(0)==0 {normally it is log2(0)==-inf}. is there a simple way to do this?
Thanks you in advance.
댓글 수: 0
답변 (1개)
Sean de Wolski
2011년 10월 5일
Write your own log2 and call it:
function out = mylog2(in)
out = log2(in);
out(~in) = 0;
end
Add the F/E output options if desired.
It would be very dangerous to overload this function since it's probably used elsewhere.
댓글 수: 4
Sean de Wolski
2011년 10월 5일
I'm holding to ~x, logical and foolproof, no, doh! can't convert nan to logical arghh...
x==0
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating Custom Components and Libraries에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!