【正文】
); xlabel(39。) ?title(39。 ?figure(1) %誤碼率和每比特信噪比間的關(guān)系曲線 ?semilogx(gamma,p_error); xlabel(39。 ?a=ones(m,n)。 ?p_error=q(sqrt(2.*gamma))。 ② 根據(jù)關(guān)系式, 可得 C和 的關(guān)系曲線, )2( ?Qp ?))2((1 ?QHC b???設(shè) SNR(gamma)在 20dB—— 20dB 計(jì)算 ))2((1 ?QHC b??繪圖 gamma- capacity曲線 繪圖 gammaPe曲線 Q(x)函數(shù) Entropy3函數(shù) SNR(gamma)轉(zhuǎn)換 仿真實(shí)驗(yàn) )2( g a m m aQP e ?有關(guān) MATLB函數(shù)介紹 ? size Size of matrix. ? D = SIZE(X), for MbyN matrix X, returns the twoelement row vector D = [M, N] containing the number of rows and columns in the matrix. ? [M,N] = SIZE(X) returns the number of rows and columns in separate output variables. ? M = SIZE(X,DIM) returns the length of the dimension specified by the scalar DIM. For example, SIZE(X,1) returns the number of rows. ? m = size(rand(2,3,4),2) m = 3 ? d = size(rand(2,3,4)) d = 2 3 4 ? [m,n,p] = size(rand(2,3,4)) m = 2 n = 3 p = 4 Example 1 Example 2 ? X = ones(3,4,5) ? [d1,d2,d3] = size(X) d1 = 3 ,d2 = 4 ,d3 = 5 ? [d1,d2] = size(X) d1 = 3, d2 = 20 ? [d1,d2,d3,d4,d5,d6] = size(X) d1 = 3 ,d2 = 4 ,d3 = 5 ,d4 = 1, d5 = 1, d6 = 1 有關(guān) MATLB函數(shù)介紹 ? semilogx Semilog scale plot. ? SEMILOGX(...) is the same as PLOT(...), except a logarithmic (base 10) scale is used for the Xaxis. 有關(guān) MATLB函數(shù)介紹 ? semilogy Semilog scale plot. ? SEMILOGY(...) is the same as PLOT(...), except a logarithmic (base 10) scale is used for the Yaxis. 本例的 MATLAB程序如下 ?gamma_db=[20::20]。([m a x)( pHBAIAp ??)]。 ? ② 繪出信道容量與 的函數(shù)關(guān)系曲線 。 其中 , E為每個(gè) BPSK信號(hào)的能量 , 為噪聲功率譜密度 。 該信道使用BPSK信號(hào) , 且在輸出端使用最佳匹配濾波判決來進(jìn)行硬判決解碼 。二進(jìn)制對(duì)稱信道對(duì)應(yīng)于 , 其中 ε 稱為信道的轉(zhuǎn)移概率 。 信道容量的計(jì)算 ? 1 信道模型 ? 最簡單的情況是用信道輸出在相應(yīng)輸入下的條件概率來建模。其中的一些變化本質(zhì)上是必然的,如衰減、線性和非線性失真;還有一些變化是隨機(jī)的,如加性噪聲、多徑衰落。 %調(diào)用求平均信息量的函數(shù) ? 平均信息量為 ? r= 思考 ? 請(qǐng)考慮如何仿真信源為均勻分布 a=1。 %有效數(shù)字 8位 f=vpa(f)。 %定義正態(tài)分布函數(shù)的方差 f=exp((xu)^2/2*o^2)/o*sqrt(2*pi)。) ? 得到結(jié)果 ? p = ? w = 2 示例及 MATLAB實(shí)現(xiàn) ? 例如,求一個(gè)正態(tài)分布的信源平均信息量 syms x u o %用來定義符號(hào)變量和表達(dá)式 u=3。 digits(8) %有效數(shù)字 8位 r int函數(shù) ? int Integrate. ? int(S) is the indefinite integral of S with respect to its symbolic variable. ? int(S,v) is the indefinite integral of S with respect to v. v is a scalar SYM. ? int(S,a,b) is the definite integral of S with respect to its symbolic variable from a to b. a and b are each double or symbolic scalars. ? int(S,v,a,b) is the definite integral of S with respect to v from a to b. digits and vpa ? vpa:轉(zhuǎn)換為阿拉伯?dāng)?shù)字表示形式(小數(shù)形式) ? digits(25) ? p = vpa(pi) ? w = vpa(39。平均信息量為 39。 r=int(t,inf,inf)。 2 示例及 MATLAB實(shí)現(xiàn) ? 仿真分析 ? P在 01范圍內(nèi)變化時(shí), H( P) ? P=0, P=1。)。 ylabel(39。概率 p39。 %定義數(shù)據(jù)點(diǎn) y=(x.*log(x)/log(2)+(1x).*log(1x)/log(2))。作出平均信息量與概率 p的關(guān)系圖。)。 ? end ? disp(39。 ? r=0。 ? 也可以定義在已知信源 Y中出現(xiàn)條件下 , X中出現(xiàn)的條件平均信息量: ? 平均互信息量: )()(l o g)()( 2 b itxyPyxPXYHi j ijji? ???)()(l o g)()( 2 b ityxPyxPYXHi j jiji? ???? ?? ?????i j jijjii j ijijiyPxyPyxPxPyxPyxPYXI)()(l o g)()()(l o g)(),(22 信息的度量 ? 2 示例及 MATLAB實(shí)現(xiàn) ? 若二元信源的統(tǒng)計(jì)特性為 , p+q=1 計(jì)算該信源的平均信息量 H(X) 解: 單個(gè)離散信息源的平均信息量為: ??????qpxx 21)(l o gl o g)( 22 比特qqppXH ??? 信息的度量 ? 2 示例及 MATLAB實(shí)現(xiàn) ? 用 MATLAB來計(jì)算信息量如下: ? x=[ ]。 信息的度量 ? 1 原理分析 ? 對(duì)離散信源 , 設(shè)其概率分布為: ? 此信源的平均信息量 ( 熵 ) 為: ? 以 e為底 , 單位由比特 (bit)改為奈特 (nit)。 信息的度量 ? 消息源可以產(chǎn)生連續(xù)消息和離散消息 , ? 通常我們認(rèn)為一個(gè)消息源產(chǎn)生消息的規(guī)律是按一定概率隨機(jī)分布的 , 可以是連續(xù)的 , 也可以是離散的 。 消息是以具體信號(hào)的形式表現(xiàn)出來 , 攜帶有抽象的信息 , 為了衡量通信系統(tǒng) , 應(yīng)當(dāng)對(duì)被傳輸?shù)南⑦M(jìn)行定量的測量 。 3 誤差分析 ? SIMULINK模塊庫中的誤碼儀 (Error Rate Calculation) 可以顯示發(fā)送端與接收端碼元的比較,計(jì)算錯(cuò)誤碼元數(shù)、誤碼率、錯(cuò)誤比特?cái)?shù)和誤比特率。 ? 語法: [numb, ratio]= symerr(x, y); ? [numb, ratio]= symerr(x, y, opt); ? 說明:比較兩個(gè)矩陣 x, y對(duì)應(yīng)元素 , 統(tǒng)計(jì)出不同元素的個(gè)數(shù) , 并計(jì)算出比率 。columnwise39。2 3 5] ? y=[1 23 2。 number2=1,ratio1=1/(3*2)=1/6。 ? 語法: [number, ratio]= biterr(x, y); ? [number,ratio]= biterr(x, y, K); ? [number,ratio]= biterr(x,y,K,’columnwise’) ? 指定 x 、 y 中 每 個(gè) 元 素 用 k 位 二 進(jìn) 制 數(shù) 表示; ’ columnwise’指定按列比較 。 % Plot dots