【正文】
lot(t, sig, t, quant, ’’); 0 10 20 30 40 50 60 701 0 . 8 0 . 6 0 . 4 0 . 200 . 20 . 40 . 60 . 81 非均勻量化- 壓縮擴(kuò)張器 ? 壓縮器 (pressor); ? 擴(kuò)張器 (expander) 壓縮擴(kuò)張器 非均勻量化 壓縮擴(kuò)張器 ? μ 律壓縮: V:輸入信號(hào) x的峰值 , 也是輸出信號(hào) y的峰值 μ : 壓擴(kuò)器的 μ 律參數(shù) ? U律擴(kuò)張 : ? A律壓縮 ? A律擴(kuò)張 )s g n ()1ln ( )/1ln ( yu vxuVy ???)s g n ()1( /)1l n ( yeuVx Vuy ?? ????????????????VxVAxA VxAVVAxxAxAy/)s g n (ln1 )/ln1(/0)s g n (ln1??????????????? VyAVyAVeAVyyAAyxVAyln1)sg n (ln10)sg n (ln11/)ln1( 壓縮擴(kuò)張器 ? 函數(shù): ? ◆ pand: ? 功能:在信源編碼中按 A律或 μ 律對(duì)輸入信號(hào)進(jìn)行擴(kuò)張和壓縮 ? 語(yǔ)法: out=pand(in,param,V)。 ? 在實(shí)際應(yīng)用中 , 通信工程師們通常會(huì)知道一些關(guān)于發(fā)送信號(hào)的先驗(yàn)信息 。 定義預(yù)測(cè)誤差為 : ? 該函數(shù)用標(biāo)量量化法進(jìn)行量化 。 ? 語(yǔ)法 :indx= dpcmenco(sig, codebook, partition,predictor) ? [indx , quant] = dpcmenco(sig , codebook ,partition, predictor) ? sig是輸入信號(hào); predictor是預(yù)測(cè)器的預(yù)測(cè)傳遞函數(shù)系數(shù); codebook是碼本; partition是量化閾值 。 ? 語(yǔ)法 :sig= dpcmdeco(indx, codebook, predictor) ? [sig, quanterror]= dpcmdco(indx, codebook, predictor); ? 它對(duì)輸入的編碼信號(hào)進(jìn)行差分脈碼調(diào)制的譯碼 。k39。 % 比較原始信號(hào)與量化信號(hào) 預(yù)測(cè)量化 預(yù)測(cè)量化 (predictive quantization) ? 3 DPCM程序舉例 ? 注意 :譯碼中用的預(yù)測(cè)器必須同編碼中使用的一樣 。 ? 作業(yè) 1:請(qǐng)編寫程序 , 計(jì)算 DPCM的量化誤差 , 并且與上次標(biāo)量量化的誤差比較 。 這里的失真僅有 , 要遠(yuǎn)遠(yuǎn)低于標(biāo)量量化中的。y..39。 ? [sig, quanterror]= dpcmdeco(indx, codebook,predictor)還可輸出量化的預(yù)測(cè)誤差。 2 通信工具箱的有關(guān)函數(shù) ? dpcmopt ? 功能:通過(guò)訓(xùn)練數(shù)據(jù)優(yōu)化差分脈碼調(diào)制參數(shù) ? 語(yǔ)法: predictor= dpcmopt(training_set, ord); ? [predictor , codebook , partition] =dpcmopt(training_set, ord, ini_codebook); ? 按給定的傳遞函數(shù)階數(shù) ord和訓(xùn)練數(shù)據(jù)來(lái)估計(jì)預(yù)測(cè)傳遞函數(shù)系數(shù) , 還可以優(yōu)化預(yù)測(cè)誤差的量化碼本和量化閾值 。 訓(xùn)練數(shù)據(jù)代表在 DPCM量化中使用的輸入數(shù)據(jù) 。 預(yù)測(cè)量化 (predictive quantization) 1 預(yù)測(cè)量化簡(jiǎn)介 使用過(guò)去的數(shù)據(jù)集和一個(gè)預(yù)測(cè)器 , 需要預(yù)測(cè)的值可以表示為 k表示計(jì)算的階數(shù) 。 輸入信號(hào) x大于 0時(shí) A律十三折曲線和 μ律十五折曲線中輸入信號(hào)與輸出信號(hào)之間的對(duì)應(yīng)關(guān)系如下表所示 。 Examples ? [index,quants] = quantiz([3 34 84 40 23],10:10:90,10:10:100) ? index = ? 0 3 8 3 2 ? quants = ? 10 40 90 40 30 標(biāo)量量化 ? 3分界點(diǎn)矢量與編碼手冊(cè)的參數(shù)訓(xùn)練設(shè)置 ? 量化的關(guān)鍵在于 分界點(diǎn)矢量 和 編碼手冊(cè) 的參數(shù)設(shè)置 ? 利用函數(shù) lloyds訓(xùn)練 (training)的方法來(lái)獲得這兩個(gè)參數(shù)。 ? 索引值 indx(x)就是量化編碼函數(shù)的輸出 。) 100101102103104105050100150200250300350400450500c a p a c i t y v s . b a n d w i d t h i n a n A W G N c h a n n e lB a n d w i d t h ( H z )capacity (bits/second) 信源編 /譯碼 ? 標(biāo)量量化 ? 預(yù)測(cè)量化 標(biāo)量量化 0 1 2 3 4 5 6 7 81 0 . 8 0 . 6 0 . 4 0 . 200 . 20 . 40 . 60 . 81標(biāo)量量化信號(hào)波形 標(biāo)量量化 ?????????????xNp a rt i t i o nNip a rt i t i o nxip a rt i t i o nip a rt i t i o nxxi n d x)1(1)1()()1(0)( 標(biāo)量量化 indx quantiz 0 1 2 N1 0a1a2a1?Na碼本(編碼手冊(cè))- code 標(biāo)量量化 ? 信源編碼計(jì)算過(guò)程 序號(hào) + 失真 … 支路 ( 1 ) 支路 ( 2 ) 支路 (N 1) 碼本 ( . )2 存儲(chǔ) /M 信號(hào) 值 ????Miiqu anis igMdi s t or t ion12))()((1 標(biāo)量量化 2 通信工具箱提供的有關(guān)函數(shù) ◆ quantiz 功能:產(chǎn)生一個(gè)量化序號(hào)和輸出量化值 。Bandwidth(Hz)39。 ? capacity=w.*log2(1+pn0./w)。capacity (bits/second)39。) ? xlabel(39。 ? capacity=3000.*log2(1+pn0/3000)。 20N2 信道容量計(jì)算舉例 ? 求解 ? ① 繪出帶寬為 W=3000Hz的加性高斯白噪聲信道容量和 間的函數(shù)關(guān)系曲線,在 20dB到 30dB的范圍內(nèi)取值。) ? 文件 function [y]=q(x) y=(1/2)*erfc(x/sqrt(2))。); ?title(39。) ?title(39。 ?a=ones(m,n)。 ② 根據(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 Exa