《MATLAB基礎(chǔ)與實(shí)例進(jìn)階》由會(huì)員分享,可在線閱讀,更多相關(guān)《MATLAB基礎(chǔ)與實(shí)例進(jìn)階(39頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。
1、,單擊此處編輯母版標(biāo)題樣式,單擊此處編輯母版文本樣式,第二級(jí),第三級(jí),第四級(jí),*,機(jī)械工業(yè)出版社,Page,*,單擊此處編輯母版標(biāo)題樣式,單擊此處編輯母版文本樣式,第二級(jí),第三級(jí),第四級(jí),*,Page,*,2024/10/8,機(jī)械工業(yè)出版社,Page,1,第,14,章,MATLAB,通信系統(tǒng)仿真,【,學(xué)習(xí)目標(biāo),】,了解數(shù)字通信系統(tǒng)基本概念,掌握數(shù)字調(diào)制,/,解調(diào)及其仿真,掌握信道編碼,/,譯碼及其仿真,2024/10/8,機(jī)械工業(yè)出版社,Page,2,第,14,章,MATLAB,通信系統(tǒng)仿真,數(shù)字通信系統(tǒng)基本概念,14.1,數(shù)字調(diào)制,/,解調(diào)及其仿真,14.2,信道編碼,/,譯碼及其仿真,14
2、.3,典型數(shù)字通信仿真實(shí)例,14.4,2024/10/8,機(jī)械工業(yè)出版社,Page,3,14.1,數(shù)字通信系統(tǒng)基本概念,2024/10/8,機(jī)械工業(yè)出版社,Page,4,14.2,數(shù)字調(diào)制,/,解調(diào)及其仿真,14.2.1,脈沖幅度調(diào)制(,PAM,)信號(hào),14.2.2,相位調(diào)制(,PSK,)信號(hào),14.2.3,頻率調(diào)制信號(hào),14.2.4,連續(xù)相位調(diào)制信號(hào),2024/10/8,機(jī)械工業(yè)出版社,Page,5,1.,脈沖幅度調(diào)制(,PAM,)信號(hào),2024/10/8,機(jī)械工業(yè)出版社,Page,6,1.,脈沖幅度調(diào)制(,PAM,)信號(hào),參數(shù)名稱,參數(shù)值,M-ary number(M維數(shù)),4,Initi
3、al seed(初始化種子),37,Sample time(采樣時(shí)間),0.01,Random Integer Generator,(隨機(jī)整數(shù)發(fā)生器)的主要參數(shù),M-PAM,調(diào)制和解調(diào)器的主要參數(shù),參數(shù)名稱,參數(shù)值,M-ary number(M維數(shù)),4,Minimum distance(最小距離),2,Constellation ordering(星座順序),Binary,2024/10/8,機(jī)械工業(yè)出版社,Page,7,1.,脈沖幅度調(diào)制(,PAM,)信號(hào),AWGN Channel,(高斯白噪聲信道)的主要參數(shù),Discrete-Time Scatter Plot Scope,(離散時(shí)間星
4、座儀)的主要參數(shù),參數(shù)名稱,參數(shù)值,Initial seed(初始化種子),67,Es/No(dB)(信噪比),25,Symbol period(符號(hào)周期),1,參數(shù)名稱,參數(shù)值,Samples per symbol(每符號(hào)采樣),1,Offset(samples)(偏置),0,Points displayed(顯示點(diǎn)數(shù)),1000,New points per display(每次顯示的新跡),500,2024/10/8,機(jī)械工業(yè)出版社,Page,8,1.,脈沖幅度調(diào)制(,PAM,)信號(hào),Error Rate Calculation,(誤碼率計(jì)算)的主要參數(shù),參數(shù)名稱,參數(shù)值,Receive
5、 delay(接收延遲),0,Computation delay(計(jì)算延遲),0,Computation mode(計(jì)算模式),Entire frame,Output data(輸出數(shù)據(jù)),port,2024/10/8,機(jī)械工業(yè)出版社,Page,9,2.,相位調(diào)制(,PSK,)信號(hào),2024/10/8,機(jī)械工業(yè)出版社,Page,10,2.,相位調(diào)制(,PSK,)信號(hào),M-PSK Modulator Baseband,(,M-PSK,基帶調(diào)制器)的主要參數(shù),參數(shù)名稱,參數(shù)值,M-ary number(M維數(shù)),8,Phase offset(rad)(相位偏差),pi/8,Constellatio
6、n ordering(星座順序),Binary,Input type(輸入類型),Integer,2024/10/8,機(jī)械工業(yè)出版社,Page,11,3.,頻率調(diào)制信號(hào),2024/10/8,機(jī)械工業(yè)出版社,Page,12,3.,頻率調(diào)制信號(hào),Bernoulli Binary Generator,(伯努利二進(jìn)制隨機(jī)數(shù)產(chǎn)生器)的主要參數(shù),參數(shù)名稱,參數(shù)值,Probability of a zero(0出現(xiàn)的概率),0.5,Initial seed(初始化種子),61,Sample time(采樣時(shí)間),0.1,Frame-based output(基于幀輸出),使能,Samples per fra
7、me(每幀采樣數(shù)),10,M-FSK Modulator Baseband,(,MFSK,基帶調(diào)制器)的主要參數(shù),參數(shù)名稱,參數(shù)值,M-ary number(M維數(shù)),4,Input type(輸入類型),Bit,Symbol set ordering(符號(hào)順序),Binary,Frequency separation(Hz)(頻率間隔),10,Phase continuity(相位連續(xù)性),Discontinuous,Samples per symbol(每符號(hào)采樣數(shù)),16,2024/10/8,機(jī)械工業(yè)出版社,Page,13,4.,連續(xù)相位調(diào)制信號(hào),2024/10/8,機(jī)械工業(yè)出版社,Pa
8、ge,14,4.,連續(xù)相位調(diào)制信號(hào),GMSK Modulator Baseband,(,GMSK,基帶調(diào)制器)的主要參數(shù),參數(shù)名稱,參數(shù)值,Input type(輸入類型),Bit,BT product(BT乘積),0.3,Pulse length(symbol intervals)(符號(hào)間隔),3,Symbol prehistory(符號(hào)前史),1,Phase offset(rad)(相位偏置),0,Samples per symbol(每符號(hào)采樣數(shù)),16,2024/10/8,機(jī)械工業(yè)出版社,Page,15,14.3,信道編碼,/,譯碼及其仿真,14.3.1,線性分組碼,14.3.2,循環(huán)
9、碼,14.3.3,卷積碼,2024/10/8,機(jī)械工業(yè)出版社,Page,16,1,線性分組碼,MATLAB,中使用,encode,、,decode,可以實(shí)現(xiàn)線性分組碼的編譯碼。,encode,函數(shù)的語(yǔ)法形式如下:,code=encode(msg,n,k,linear/fmt,genmat),code=encode(msg,n,k,cyclic/fmt,genpoly),code=encode(msg,n,k,hamming/fmt,prim_poly),code=encode(msg,n,k),code,added=encode(.),使用,encode,可以實(shí)現(xiàn)線性分組碼、循環(huán)碼、漢明碼的編
10、碼。,2024/10/8,機(jī)械工業(yè)出版社,Page,17,1,線性分組碼,函數(shù)參數(shù)的含義如下:,msg,:信息序列,可以是二進(jìn)制行或列向量,也可以是二進(jìn)制矩陣,也可以是十進(jìn)制行或列向量;,n,k,:分別為碼長(zhǎng)和信息分組長(zhǎng)度;,fmt,:表示編碼進(jìn)制數(shù),默認(rèn)為二進(jìn)制,(binary),;,genmat,:表示線性分組碼的生成矩陣;,genpoly,:表示循環(huán)碼的生成多項(xiàng)式,可以由函數(shù),cyclpoly(n,k),實(shí)現(xiàn);,prim_poly,:表示采用漢明編碼時(shí)的本原多項(xiàng)式,可以由函數(shù),gfprimdf(n-k),實(shí)現(xiàn)。,2024/10/8,機(jī)械工業(yè)出版社,Page,18,1,線性分組碼,【,例,
11、10-1】encode,函數(shù)使用示例:采用三種不同的格式(二進(jìn)制向量、二進(jìn)制矩陣以及十進(jìn)制向量)生成(,7,4,)漢明碼。,clc;clear all;close all;,m=3;,n=2m-1;%,碼長(zhǎng)=7,k=2m-1-m;%,信息分組長(zhǎng)=4,%,生成50個(gè)信息分組,每個(gè)分組k比特,msg1=randint(50*k,1,0,1);%,列向量,msg2=vec2mat(msg1,k);%,轉(zhuǎn)換為k維列向量的矩陣,msg3=bi2de(msg2);%,轉(zhuǎn)換為十進(jìn)制整數(shù)的行向量,2024/10/8,機(jī)械工業(yè)出版社,Page,19,1,線性分組碼,%,生成50個(gè)碼字,每個(gè)碼字n比特,code1
12、=encode(msg1,n,k,hamming/binary);,code2=encode(msg2,n,k,hamming/binary);,code3=encode(msg3,n,k,hamming/decimal);,%,判斷三種方法生成的碼字是否相同,if(vec2mat(code1,n)=code2&de2bi(code3,n)=code2),disp(All three formats produced the same content.),end,2024/10/8,機(jī)械工業(yè)出版社,Page,20,2,循環(huán)碼,循環(huán)碼,BCH,碼,里德,-,所羅門(,RS,)碼,2024/10/
13、8,機(jī)械工業(yè)出版社,Page,21,2,循環(huán)碼,【,例,encode,和,decode,函數(shù)使用示例:對(duì),(15,4),循環(huán)碼進(jìn)行編譯碼。,clc;clear all;close all;,n=15;k=4;,genpoly=cyclpoly(n,k,max);,%,構(gòu)造循環(huán)碼多項(xiàng)式,msg=randint(100,k,0,1);,%100,個(gè)信息分組,code=encode(msg,n,k,cyclic/binary,genpoly);,noisycode=rem(code+randerr(100,n,0 1;.7.3),2);%,加噪聲,newmsg=decode(noisycode,n,
14、k,cyclic);%,譯碼,number,ratio=biterr(newmsg,msg);%,計(jì)算誤碼率,disp(The bit error rate is,num2str(ratio),2024/10/8,機(jī)械工業(yè)出版社,Page,22,2,循環(huán)碼,BCH,碼,bchenc,函數(shù)的語(yǔ)法形式如下:,code=bchenc(msg,n,k),code=bchenc(.,paritypos),這兩個(gè)函數(shù)可以用于生成,BCH,碼,其中,msg,的數(shù)據(jù)結(jié)構(gòu)必須為,Galois array,。,與,bchenc,相對(duì)應(yīng)的函數(shù)是,bchdec,,函數(shù)的語(yǔ)法形式如下:,decoded=bchdec(c
15、ode,n,k),decoded,cnumerr,ccode=bchdec(.),cnumerr,:表示與,code,相對(duì)應(yīng)的糾正的錯(cuò)誤個(gè)數(shù);,ccode,:表示經(jīng)過(guò)錯(cuò)誤糾正后的碼字;,decoded,:表示返回的譯碼結(jié)果。,2024/10/8,機(jī)械工業(yè)出版社,Page,23,2,循環(huán)碼,【,例,10-4】BCH,碼編譯碼仿真示例。,clc;clear all;close all;,m=4;n=2m-1;%,碼字長(zhǎng)度,k=5;%,信息符號(hào)長(zhǎng)度,nwords=10;%,編碼個(gè)數(shù),msg=gf(randint(nwords,k);,genpoly,t=bchgenpoly(n,k);%,獲得生成多
16、項(xiàng)式及相應(yīng)的糾錯(cuò)能力t,t2=t;,code=bchenc(msg,n,k);%,編碼,noisycode=code+randerr(nwords,n,1:t2);%,對(duì)每個(gè)碼字加t2比特錯(cuò)誤,2024/10/8,機(jī)械工業(yè)出版社,Page,24,2,循環(huán)碼,newmsg,err,ccode=bchdec(noisycode,n,k);%,譯碼,if ccode=code,disp(All errors were corrected.),end,if newmsg=msg,disp(The message was recovered perfectly.),end,2024/10/8,機(jī)械工業(yè)出版社,Page,25,2,循環(huán)碼,【,例,10-5】RS,碼編譯碼仿真示例。,m=3;%,每符號(hào)比特?cái)?shù),n=2m-1;k=3;,%,碼字長(zhǎng)度和信息長(zhǎng)度,t=(n-k)/2;%rs,碼的糾錯(cuò)能力,nw=4;%,碼字個(gè)數(shù),msgw=gf(randint(nw,k,2m),m);%,生成隨機(jī)信息符號(hào),c=rsenc(msgw,n,k);%,編碼,noise=(1+randint(nw,n,2m-1).*