Function, How to write this formula in Matlab
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have been trying to write this formula in matlab, but I have not had many results. The formula is as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/855215/image.png)
in addition, the Ln must have a conditional, where, if Pi is negative or equal to 0, the result of the ln of that Pi is 0.
If someone can help me, it would be very helpful
Thanks
0 Kommentare
Antworten (1)
Walter Roberson
am 6 Jan. 2022
W = log(p);
W(p <= 0) = 0;
N = exp(-sum( p .* W));
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!