D=0.:0.005:0.5;

R=zeros(1,101);
for i=1:101
    R(i)=1+log2(D(i))*D(i)+(1-D(i))*log2(1-D(i));
end

    
plot(D,R);