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 CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by