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!