Formulation to Matlab code
이전 댓글 표시
How to write this formulation in Matlab:

is it :
for i=1:N
S(i) = -PT(i) * log(PT(i));
end
댓글 수: 2
Dimitris Kalogiros
2019년 5월 14일
What is the base of the logarithm? Is it 10 ? If so, then you must use log10() .
Maroco Sc
2019년 5월 14일
채택된 답변
추가 답변 (1개)
Raj
2019년 5월 14일
Since your equation asks for 'log' not 'ln' , I think the code should be:
for i=1:N
S(i) = -PT(i) * log10(PT(i));
end
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!