Matlab入门3

上传人:206****923 文档编号:54848227 上传时间:2018-09-20 格式:PPT 页数:122 大小:1.05MB
返回 下载 相关 举报
Matlab入门3_第1页
第1页 / 共122页
Matlab入门3_第2页
第2页 / 共122页
Matlab入门3_第3页
第3页 / 共122页
Matlab入门3_第4页
第4页 / 共122页
Matlab入门3_第5页
第5页 / 共122页
点击查看更多>>
资源描述

《Matlab入门3》由会员分享,可在线阅读,更多相关《Matlab入门3(122页珍藏版)》请在金锄头文库上搜索。

1、第三章 信源、信道容量和信源编码,3.1 信源、信宿和误差分析,3.1.1 信号产生设备 通信工具箱的仿真模块库包含高斯、瑞利、泊松和均匀分布的噪声发生器。,3.1.1 信号产生设备,3.1.1 信号产生设备,高斯噪声发生器n维高斯噪声的概率密度函数(pdf)表达式为:,均值,方差,不同的Initial seed对应于不同的输出,相同的Initial seed产生相同的输出。只要设置相同的Initial seed就能够再现相同的随机过程,3.1.1 信号产生设备,(2)瑞利噪声发生器瑞利分布等效于一个二维零均值高斯变量的均方和(RssRoot sum squares)。假设y1和y2是两个独立

2、的高斯随机变量,均值为零,方差为2,则服从瑞利分布的随机变量x的表达式为:瑞利分布的概率密度函数为:,Sigma(衰减包络) 用于确定瑞利随机过程的参数,对应于公式中的。,Initial seed(随机数种子,3.1 信源、信宿和误差分析,3.1.1 信号产生设备 (3)均匀分布噪声发生器uniform noise generator 当ab时,均匀分布的随机变量x的概率密度函数为:该分布的均值为:1/2(a+b) 方差为:1/12(a+b)2,输出噪声被均匀分布的上限和下限,贝努利分布,泊松分布,3.1 信源、信宿和误差分析,3.1.1 信号产生设备 (4)泊松随机整数发生器 泊松分布的概率

3、密度函数为:,lambda 指定泊松参数。当它是标量时,输出矢量的每一分量具有相同的值。当它是矢量时,此矢量长度须与“种子”的矢量长度相等,seed 初始化“种子”值。,3.1.2 信号观测设备,观测设备包括示眼图、散列图(scatter plot)和错误率计算(error-rate computation)设备。 通信工具箱对生成这些观测设备的SIMULINK模块和MATLAB函数均提供支持。,3.1.2 信号观测设备,1 眼图 生成眼图的方法:用一个滤波器以1/T的频率对信号进行扫描,这里T为码元周期,则扫描信号的连续叠加就会生成输出的眼图。基带传输系统中,接收滤波器的输出信号加到示波器的

4、垂直轴,调节示波器的水平扫描周期,使之与信号码元的周期同步。,3.1.2 信号观测设备,1 眼图 二进制信号传输时的眼图只有一只“眼睛”,当传输三元码时,会显示两只“眼睛”。眼图是由各段码元波形叠加而成的,眼图中央的垂直线表示最佳抽样时刻,位于两峰值中间的水平线是判决门限电平,3.1.2 信号观测设备,1 眼图,最佳抽样时刻,最大信号失真量,斜率对定时误差的敏感度,可以抽样的时间,噪声容限,过零点失真,3.1.2 信号观测设备,1 眼图 eyediagram函数eyediagram(x,n) eyediagram(x,n,period) eyediagram(x,n,period,offset

5、) eyediagram(x,n,period,offset,plotstring) eyediagram(x,n,period,offset,plotstring,h) h = eyediagram(.),3.1.2 信号观测设备,1 眼图 M=16; Fs=10; Pd=100; Fd=1; %定义计算的点数 msg_d=randint(Pd,1,M);%0,M-1中生成整数消息 %QAM调制 msg_a=qammod(msg_d,M); %假设信道等效于一个升余弦滤波器 rcv_a=rcosflt(msg_a,Fd,Fs,fir/normal); %输出接收信号的眼图 eyediagra

6、m(rcv_a,Fs/Fd,1/Fd,2);,Fs是输入观察信号x的抽样频率;Fd是信号观察窗口时间的倒数。一般要求FsFd,且Fs/Fd为一正整数。,randint,randint Random integer matrix generator.OUT = RANDINT(N) generates an N-by-N matrix of random binary numbers. The appearance of “0“ and “1“ have even probability.OUT = RANDINT(N, M) generates an N-by-M matrix of rand

7、om binary numbers. The appearance of “0“ and “1“ have even probability.OUT = RANDINT(N, M, RANGE) generates an N-by-M matrix of random integer numbers. RANGE(1), RANGE(2) even probability 0, RANGE-1.,randint,randint(2,2,0 3) ans =3 20 1,Quadrature amplitude modulation Syntax y = qammod(x,M) y = qamm

8、od(x,M,ini_phase) y = qammod(x,M,ini_phase,symbol_order)If symbol_order is set to bin (default), the function uses a natural binary-coded ordering. If symbol_order is set to gray, it uses a Gray constellation ordering.,qammod,rcosflt,Filter input signal using raised cosine filter Syntax y = rcosflt(

9、x,Fd,Fs) y = rcosflt(x,Fd,Fs,type_flag,r,delay,tol),The sample frequency for the digital input signal x is Fd, and the sample frequency for the output signal y is Fs.,y = rcosflt(x,Fd,Fs,filter_type/Fs,r,delay,tol) y = rcosflt(x,Fd,Fs,filter_type/filter,num,den) y = rcosflt(x,Fd,Fs,filter_type/filte

10、r,num,den,delay) y = rcosflt(x,Fd,Fs,filter_type/filter/Fs,num,den.) y,t = rcosflt(.),delay is the filters group delay, measured in input samples. The actual group delay in the filter design is delay/Fd seconds.,r is the rolloff factor for the filter, a real number in the range 0, 1.,The input tol i

11、s the tolerance in the IIR filter design. FIR filter design does not use tol.,1 眼图,3.1.2 信号观测设备,2散列图(scatterplot) 散列图同眼图有密切的关系。它记录判决点处接收信号的值。 scatterplot(x) scatterplot(x,n) scatterplot(x,n,offset) scatterplot(x,n,offset,plotstring) scatterplot(x,n,offset,plotstring,h) h = scatterplot(.),% Define th

12、e M-ary number and sampling rates. M = 16; Fd = 1; Fs = 10; N = Fs/Fd; Pd = 200; % Number of points in the calculation % Random integers in the range 0,M-1 msg_d = randint(Pd,1,M); % Modulate using square QAM. msg_a = qammod(msg_d,M); % Assume the channel is equivalent to a raised cosine filter. rcv

13、 = rcosflt(msg_a,Fd,Fs); % Create the scatter plot of the received signal, % ignoring the first three and the last four symbols. rcv_a = rcv(3*N+1:end-4*N,:);h = scatterplot(rcv_a,N,0,bx);,Offset为不是最优点hold on; scatterplot(rcv_a,N,N+1,r+,h); % Plot +s scatterplot(rcv_a,N,N-1,mx,h); % Plot xs scatterp

14、lot(rcv_a,N,0,b.,h); % Plot dots,3.1.2 信号观测设备,眼图,散列图,3.1.2 信号观测设备,眼图模块及其参数设置,每个符号的采样数,每个迹的符号数,眼 图 参 数 设 置,3.1.2 信号观测设备,眼图的线条设置,眼图的颜色设置,眼图的标识设置,眼图的线条设置,3.1.2 信号观测设备,3 误差分析 在估计通信系统的设计质量和技术、算法的性能时,通常使用误码率进行分析。 (1) Number of error bits (2) Number of error symbols和symbol error rate,3 误差分析,biterr 功能:误比特数、

15、误比特率计算。 语法:number,ratiobiterr(x,y);number,ratiobiterr(x,y,K);number,ratiobiterr(x,y,K,column-wise)指定x、y中每个元素用k位二进制数表示;columnwise指定按列比较。,3 误差分析,例如,x=1,2,3, y=1,2,2 number1,ratio1=biterr(x,y,3),则x、y中每个元素用3位二进制数表示,number2,ratio2=biterr(x,y,2),则x、y中每个元素用2位二进制数表示,,number1=1,ratio1=1/(3*3)=1/9。,number2=1,

16、ratio1=1/(3*2)=1/6。,3 误差分析,x=1 1 2;2 3 5 y=1 23 2;2 9 5 number,ratio=biterr(x,y,5,column-wise),每列的误比特率 0 0.5000 0,3 误差分析,symerr 功能:比较两个矩阵不同元素的个数和比率。 语法:numb,ratiosymerr(x,y);numb,ratiosymerr(x,y,opt); 说明:比较两个矩阵x,y对应元素,统计出不同元素的个数,并计算出比率。Opt参数有row-wise和column-wise,分别对应按行比较或按列比较。,3 误差分析,SIMULINK模块库中的误码仪(Error RateCalculation) 可以显示发送端与接收端码元的比较,计算错误码元数、误码率、错误比特数和误比特率。,

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 幼儿/小学教育 > 其它小学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号