Formulation to Matlab code
Ältere Kommentare anzeigen
How to write this formulation in Matlab:

is it :
for i=1:N
S(i) = -PT(i) * log(PT(i));
end
2 Kommentare
Dimitris Kalogiros
am 14 Mai 2019
What is the base of the logarithm? Is it 10 ? If so, then you must use log10() .
Maroco Sc
am 14 Mai 2019
Akzeptierte Antwort
Weitere Antworten (1)
Raj
am 14 Mai 2019
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
Kategorien
Mehr zu Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!