How i can plot the entropy function H(p1,p2,p3) for three vector of probability p1, p2 and p3= (1-p1-p2)
Show older comments
hello every one.
How i can plot the entropy function H(p1,p2,p3) for three vector of probability p1, p2 and p3= (1-p1-p2) ... I tried this script but it seems to be wrong! could any one help me plz Many Thanks
clear all
clc
p_0=[0:0.01:0.5];
p_1=[0:0.01:0.5];
[P_0,P_1] = meshgrid(p_0,p_1);
H = (-P_0.*log2(P_0)-(P_1).*log2(P_1)-(1-P_0-P_1).*log2((1-P_0-P_1)));
surf(P_0,P_1,H)
3 Comments
Ameer Hamza
on 5 May 2018
"it seems to be wrong"
MATLAB just plot what you tell it to the plot. If it seems wrong please tell why you think so. If it is wrong, there is a high chance that you wrote the equation wrong. Can you attach the image of the actual equation?
Tammun filistin
on 7 May 2018
Edited: Tammun filistin
on 7 May 2018
Tammun filistin
on 7 May 2018
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
