フィルターのクリア

how i can find the Entropy for 3 probabilities by matlab?

2 ビュー (過去 30 日間)
Tammun filistin
Tammun filistin 2018 年 5 月 27 日
コメント済み: Ankita Bansal 2018 年 6 月 4 日
Hello Every one
Im trying to calculate the entropy for three random values as shown in the following script , but it gives me an error . could any one please help me to find the correct answer. Many thanks.
if true
p00=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 ];
p01=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 ];
p02=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 ];
for i=1:length(p00)
for j=1:length(p01)
for k=1:length(p02)
p03=1-p00(1,i)-p01(1,j)-p02(1,k)
H(i,j,k) = real((-p00(1,i).*log2(p00(1,i))-(p01(1,j)).*log2(p01(1,j))-p02(i,j,k).*log2((p02(i,j,k)))-p03(i,j,k).*log2((p03(i,j,k)))))
end
end
end
end

採用された回答

Ankita Bansal
Ankita Bansal 2018 年 5 月 28 日
Hi, first thing which is incorrect in your code is that you are trying to access p02(1,1,2) however p02 is 1x7 matrix. Similarly check for other syntaxes also. Second, I am not getting what are p00, p01 and p02. What is meaning of a vector here?
  2 件のコメント
Tammun filistin
Tammun filistin 2018 年 5 月 28 日
p00, p01 and p02 it represent a vectors of probabilities and Im looking for the corresponding entropy for all the compilations of those probabilities. Thanks
Ankita Bansal
Ankita Bansal 2018 年 6 月 4 日
Hi
p00=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 ];
p01=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 ];
p02=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 ];
for i=1:length(p00)
for j=1:length(p01)
for k=1:length(p02)
p03=1-p00(1,i)-p01(1,j)-p02(1,k)
H(i,j,k) = real((-p00(i).*log2(p00(i))-(p01(j)).*log2(p01(j))-p02(k).*log2((p02(k)))-p03*log2(p03)))
end
end
end
is this what you are trying to calculate?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by