Function, How to write this formula in Matlab

1 回表示 (過去 30 日間)
Santiago
Santiago 2022 年 1 月 6 日
コメント済み: Walter Roberson 2022 年 1 月 6 日
I have been trying to write this formula in matlab, but I have not had many results. The formula is as follows:
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

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 1 月 6 日
W = log(p);
W(p <= 0) = 0;
N = exp(-sum( p .* W));
  2 件のコメント
Santiago
Santiago 2022 年 1 月 6 日
Hi Walter, thank you for your answer.
But I made some mistakes when i tried to explain my question
Walter Roberson
Walter Roberson 2022 年 1 月 6 日
Ln = log(p);
Ln(p <= 0) = 0;
N = exp(-sum( p .* Ln));

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by