数字通信原理课件:Lecture2 信号与系统_第1页
数字通信原理课件:Lecture2 信号与系统_第2页
数字通信原理课件:Lecture2 信号与系统_第3页
数字通信原理课件:Lecture2 信号与系统_第4页
数字通信原理课件:Lecture2 信号与系统_第5页
已阅读5页,还剩44页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Lecture2 信号与系统本章主要内容:q傅里叶级数仿真q傅里叶变换仿真q功率和能量【什么是傅立叶级数】n1)周期信号x(t)如果在一个周期内可积,则该周期信号可以表示成n2)傅里叶级数系数ntnfjnseFtf2)(TTtnfjnndttfTndtetfTFs0020)(10)(1【例2.1 矩形波的傅里叶级数】n问题:求双极性周期矩形波的傅立叶级数并且画出傅立叶级数展开后的波形n求解过程:根据傅立叶级数的计算公示可得编写Matlab程序画出N100时矩形波的近似波形(fb_jinshi.m)2/0)2/(sin0jnnencFF【fb_jinshi.m】给出t的离散取值求出Fn系数求和项

2、【matlab运行结果】【思考】n 怎样读取数组中的元素?n怎样表示求和项?n如果省略 仿真结果会是怎样?n自己编写P4解说题1.1【幅度谱和相位谱】n什么是幅度谱和相位谱?n傅立叶级数 通常是复数,它的模 和相位 对n或者nf0作图,就成为幅 度谱和相位谱nxnxnx【例2、求周期信号的幅度谱和相位谱】e.g.1.3求解过程:1、编写求解傅立叶系数的函数function xx=fseries(funfcn,a,b,n,tol,p1,p2,p3)2、编写生成周期信号的函数funfcn3、画出幅度和相位谱【1、傅里叶级数系数的matlab程序】nfunction xx=fseries(funfc

3、n,a,b,n,tol,p1,p2,p3)n%FSERIES Returns the Fourier series coefficients.n% It can depend on up to three parameters p1,p2, and p3. The function is given over one period extending from a to bn% xx=vector of length n+1 of Fourier Seriesn% Coefficients, xx0,xx1,.,xxn.n% p1,p2,p3=parameters of funfcn. n%

4、tol=the error level.【matlab程序】(续1)n j=sqrt(-1);nargs0=;nfor nn=1:nargin-5n args0=args0,p,int2str(nn);nendnargs=args0,);nt=b-a;nxx(1)=eval(1/(,num2str(t),).*quad(funfcn,a,b,tol,args) ;执行命令:1/(t).*quad(funfcn,a,b,tol,p1,p2)nargin=6args0=,p1;nargin=7args0=,p1,p2;args=,p1,p2);【matlab程序】(续2)nfor i=1:nn n

5、ew_fun = exp_fnct ;n args=, num2str(i), , num2str(t), args0, ) ;nxx(i+1)=eval(1/(,num2str(t),).*quad(new_fun,a,b,tol,funfcn,args);nend执行命令: 1/(12).*quad(new_fun,a,b,tol,funfcn,1,12)Matlab命令解释quadnSyntaxnq = quad(fun,a,b)nq = quad(fun,a,b,tol)nq = quad(fun,a,b,tol,trace)n用途:nQuadrature is a numerical

6、 method used to find the area under the graph of a function, that is, to compute a definite integral.【2、产生高斯函数的matlab程序】nfunction y=normal(x,m,s)n% FUNCTION y=NORMAL(x,m,s)n% Gaussian distributionn% m=meann% s=standard deviationny=(1/sqrt(2*pi*s2)*exp(-(x-m).2)/(2*s2);【3、matlab主程序Ip_01_03.m】n% MATLA

7、B script for Illustrative Problem 3, Chapter 1.necho onnfnct=normal;na=-6;nb=6;nn=24;ntol=0.1;【matlab程序】(cont.)nxx=fseries(fnct,a,b,n,tol,0,1);nxx1=xx(n+1:-1:2);nxx1=conj(xx1),xx;nabsxx1=abs(xx1);npause % Press any key to see a plot of the magnitude.nn1=-n:n;nstem(n1,absxx1)ntitle(The Discrete Magni

8、tude Spectrum)求双边幅度谱画双边幅度谱【matlab程序】(cont.)nphasexx1=angle(xx1);npause % Press any key to see a plot of the phase.nstem(n1,phasexx1)ntitle(The Discrete Phase Spectrum)画相位谱Matlab命令解释conjnconj功能:Complex conjugatenSyntax语法:ZC = conj(Z)nDescriptionZC = conj(Z) returns the complex conjugate of the elemen

9、ts of Z.nAlgorithmsIf Z is a complex array:conj(Z) = real(Z) - i*imag(Z)【程序运行结果】-30-20-10010203000.010.020.030.040.050.060.070.08The Discrete Magnitude Spectrum【程序运行结果】cont.-30-20-100102030-4-3-2-101234The Discrete Phase Spectrum思考:n自己编写P8解说题1.2【周期信号的过滤】【解答】编程思路?编程思路?【matlab程序】n% MATLAB script for I

10、llustrative Problem 4, Chapter 1.necho onnn=-20:1:20;n% Fourier series coefficients of x(t) vector nx=.5*(sinc(n/2).2;n% sampling intervalnts=1/40;n% time vectornt=-.5:ts:1.5;n% impulse responsenfs=1/ts;nh=zeros(1,20),t(21:61),zeros(1,20);在时间段01上系统冲击响应【matlab程序】cont.n% transfer functionnH=fft(h)/fs;

11、n% frequency resolutionndf=fs/80;nf=0:df:fs-fs/2;n% rearrange HnH1=fftshift(H);ny=x.*H1(21:61);n% Plotting commands follow.得到双边频率分量【matlab程序】cont.nfigure (1); % plot nplot(f,abs(H1);nfigure (2);nstem(f,abs(H1);nfigure (3);nstem(f(21:61),abs(y);【命令解释fft和fftshift】nfft(X) is the discrete Fourier transf

12、orm (DFT) of vector X.nfft(X,N) is the N-point FFT, padded with zeros if X has less than N points and truncated if it has more.nfftshift Shift zero-frequency component to center of spectrum.思考:n如何求非周期函数的傅立叶变换?n如果得到双边频谱?【程序运行结果】-20-15-10-50510152000.10.20.30.40.50.60.7【程序运行结果】(cont.)-20-15-10-5051015

13、2000.10.20.30.40.50.60.7【程序运行结果】(cont.)-10-5051000.050.10.150.20.250.30.35【傅里叶变换】n什么是傅立叶变换?n傅立叶变换是傅立叶级数对非周期信号的推广n信号的傅立叶变换成为信号的频谱,一般是个复函数,幅度谱和相位谱为:dfefXtxdtetxfXftjftj22)()()()(fXfX例5:求非周期信号的幅度和相位谱思路:思路:1、非周期信号离散化、非周期信号离散化 2、用、用DFT变换变换 3、再转变、再转变成模拟周期信号的傅立叶变换成模拟周期信号的傅立叶变换【子程序】nfunction M,m,df=fftseq(m

14、,ts,df) n% M,m,df=fftseq(m,ts,df)n% M,m,df=fftseq(m,ts)n%FFTSEQ generates M, the FFT of the sequence m.n% The sequence is zero padded to meet the required frequency resolution df.n% ts is the sampling interval. The output df is the final frequency resolution.n% Output m is the zero padded version of

15、 input m. 【子程序】cont.nfs=1/ts;nif nargin = 2n n1=0;nelsen n1=fs/df;nendnn2=length(m);nn=2(max(nextpow2(n1),nextpow2(n2);nM=fft(m,n);nm=m,zeros(1,n-n2);ndf=fs/n;Matlab命令解释nnextpow2n语法:p = nextpow2(A)nDescriptionnp = nextpow2(A) returns the smallest power of two that is greater than or equal to the abs

16、olute value of A. (That is, p that satisfies 2p = abs(A).nThis function is useful for optimizing FFT operations, which are most efficient when sequence length is an exact power of two.Matlab命令解释 (cont.)nExamplesnFor any integer n in the range from 513 to 1024, nextpow2(n) is 10.nFor vector input, ne

17、xtpow2(n) returns an element-by-element result:nA = 1 2 3 4 5 9 519nnextpow2(A)nans =n 0 1 2 2 3 4 10【matlab程序】n% MATLAB script for Illustrative Problem 1. 5.ndf=0.01;nfs=10;nts=1/fs;nt=-5:ts:5;nx1=zeros(size(t);nx1(41:51)=t(41:51)+1;nx1(52:61)=ones(size(x1(52:61); %x1(t)【matlab程序】cont.nx2=zeros(size(t);nx2(51:71)=x1(41:61); %x2(t)nX1,x11,df1=fftseq(x1,ts,df);nX2,x21,df2=fftseq(x2,ts,df);nX11=X1/fs;nX21=X2/fs;nf=0:df1:df1*(length(x11)-1)-fs/2;【matlab程序】cont.nplot(f

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论