Application of modern communication principle based on matlab

One, homework one

  • Topic: [matlab] A binary source with probability P(x=0)=1/4 is transmitted in a binary symmetric channel with crossover probability ε. Determine the range of ε that enables reliable transmission of the source. It is assumed that the channel can be used once for each input source.
  • Code:
Hu=-(1/4.*log2(1/4)+3/4.*log2(3/4));
%Hu为信源熵
p=0:0.005:1;
%x1:a:x2:在区间(x1, x2)中生成间距为a的点。
%p为传输错误率
Hb=-(p.*log2(p)+(1-p).*log2(1-p));
C=1-Hb;
%C为信道容量

x=p;
k=find(abs(C-Hu)<=0.01);
%abs(X):返回数组X中每个元素的绝对值。
%find(X):返回一个包含数组 X 中每个非零元素的线性索引的矢量。
%找出交点
x1=x(k);
y1=Hu;
plot(p,Hu,'b+',p,C,'g',x1,y1,'ro','MarkerSize',10);
%plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn):
%信源可靠传输,即Hu<C,找出两条曲线的交点即可。
  • operation result:
    Insert picture description here

Guess you like

Origin blog.csdn.net/shine_00/article/details/109301447