1、(1)所用滤波器函数:巴特沃斯滤波器% 注: wp(或Wp)为通带截止频率 ws(或Ws)为阻带截止频率 Rp为通带衰减 As为阻带衰减%butterworth低通滤波器原型设计函数 要求WsWp0 AsRp0 function b,a=afd_butt(Wp,Ws,Rp,As)N=ceil(log10(10(Rp/10)-1)/(10(As/10)-1)/(2*log10(Wp/Ws); %上条语句为求滤波器阶数 N为整数 %ceil 朝正无穷大方向取整fprintf(n Butterworth Filter Order=%2.0fn,N)OmegaC=Wp/(10(Rp/10)-1)(1/
2、(2*N) %求对应于N的3db截止频率b,a=u_buttap(N,OmegaC);(2)傅里叶变换函数function Xk=dft(xn,N)n=0:1:N-1;k=0:1:N-1;WN=exp(-j*2*pi/N);nk=n*k;WNnk=WN.(nk);Xk=xn*WNnk;设计部分:1.普通AM调制与解调%单音普通调幅波调制y=amod(x,t,fs,t0,fc,Vm0,ma)要求fs2fc%x调制信号,t调制信号自变量,t0采样区间,fs采样频率, %fc载波频率,Vm0输出载波电压振幅,ma调幅度t0=0.1;fs=12000;fc=1000;Vm0=2.5;ma=0.25;n
3、=-t0/2:1/fs:t0/2;x=4*cos(150*pi*n); %调制信号y2=Vm0*cos(2*pi*fc*n); %载波信号figure(1)subplot(2,1,1);plot(n,y2);axis(-0.01,0.01,-5,5);title(载波信号);N=length(x);Y2=fft(y2);subplot(2,1,2);plot(n,Y2);title(载波信号频谱); %画出频谱波形y=Vm0*(1+ma*x/Vm0).*cos(2*pi*fc*n);figure(2)subplot(2,1,1);plot(n,x)title(调制信号);subplot(2,1
4、,2)plot(n,y)title(已调波信号);X=fft(x);Y=fft(y);w=0:2*pi/(N-1):2*pi;figure(3)subplot(2,1,1);plot(w,abs(X)axis(0,pi/4,0,2000);title(调制信号频谱);subplot(2,1,2);plot(w,abs(Y)axis(pi/6,pi/4,0,1200);title(已调波信号频谱); %画出频谱波形y1=y-2*cos(800*pi*n);y2=Vm0*y1.*cos(2*pi*fc*n); %将已调幅波信号的频谱搬移到原调制信号频谱处wp=40/N*pi;ws=60/N*pi;
5、Rp=1;As=15;T=1; %滤波器参数设计OmegaP=wp/T;OmegaS=ws/T;cs,ds=afd_butt(OmegaP,OmegaS,Rp,As);b,a=imp_invr(cs,ds,T);y=filter(b,a,y2);figure(4)subplot(2,1,1);plot(n,y)title(解调波);Y=fft(y);subplot(2,1,2);plot(w,abs(Y)axis(0,pi/6,0,1000);title(解调信号频谱); %画出频谱波形结果:Butterworth Filter Order= 6OmegaC = 0.1171 2.抑制双边带调
6、制与解调%单音抑制载波双边带调制y=amod(x,t,fs,t0,fc,Vm0,ma)要求fs2fc%x调制信号, t0采样区间,fs采样频率, %fc载波频率,Vm0输出载波电压振幅,ma调幅度t0=0.1;fs=12000;fc=1000;Vm0=2.5;ma=0.25;n=-t0/2:1/fs:t0/2;x=4*cos(150*pi*n); %调制信号y=Vm0*x.*cos(2*pi*fc*n); %载波信号figure(1)subplot(2,1,1)plot(n,x)title(调制信号);subplot(2,1,2)plot(n,y)title(已调波信号);N=length(x
7、);X=fft(x);Y=fft(y);w=0:2*pi/(N-1):2*pi;figure(2)subplot(2,1,1)plot(w,abs(X)axis(0,pi/4,0,2000);title(调制信号频谱); %画出频谱波形subplot(2,1,2)plot(w,abs(Y)axis(pi/6,pi/4,0,2200);title(已调波信号频谱); %画出频谱波形y1=y-2*cos(2000*pi*n);y2=Vm0*y1.*cos(2*pi*fc*n); %将已调幅波信号的频谱搬移到原调制信号频谱处wp=40/N*pi;ws=60/N*pi;Rp=1;As=15;T=1;%
8、滤波器参数设计OmegaP=wp/T;OmegaS=ws/T;cs,ds=afd_butt(OmegaP,OmegaS,Rp,As);b,a=imp_invr(cs,ds,T);y=filter(b,a,y2);figure(3)subplot(2,1,1)plot(n,y)title(解调波);Y=fft(y);subplot(2,1,2)plot(w,abs(Y)axis(0,pi/6,0,5000);title(解调信号频谱); %画出频谱波形结果:Butterworth Filter Order= 6OmegaC = 0.11713.单边带调制与解调%单音单边带调制y=amod(x,t
9、,fs,t0,fc,Vm0,ma)要求fs2fc%x调制信号,t0采样区间,fs采样频率, %fc载波频率,Vm0输出载波电压振幅,ma调幅度t0=0.1;fs=12000;fc=1000;Vm0=2.5;ma=0.25;n=-t0/2:1/fs:t0/2;N=length(n);x1=4*cos(150*pi*n); %调制信号x2=hilbert(x1,N);y=(Vm0*x1.*cos(2*pi*fc*n)-Vm0*x2.*sin(2*pi*fc*n)/2;figure(1)subplot(2,1,1)plot(n,x1)title(调制信号);subplot(2,1,2)plot(n,
10、y)title(已调波信号);X=fft(x1);Y=fft(y);w=0:2*pi/(N-1):2*pi;figure(2)subplot(2,1,1)plot(w,abs(X)axis(0,pi/4,0,3000);title(调制信号频谱); %画出频谱波形subplot(2,1,2)plot(w,abs(Y)axis(pi/6,pi/4,0,2500);title(已调波信号频谱); %画出频谱波形y1=y-2*cos(1500*pi*n);y2=Vm0*y1.*cos(2*pi*fc*n); %将已调幅波信号的频谱搬移到原调制信号频谱处wp=40/N*pi;ws=60/N*pi;Rp
11、=1;As=15;T=1; %滤波器参数设计OmegaP=wp/T;OmegaS=ws/T;cs,ds=afd_butt(OmegaP,OmegaS,Rp,As);b,a=imp_invr(cs,ds,T);y=filter(b,a,y2);figure(3)subplot(2,1,1)plot(n,y)title(解调波);Y=fft(y);subplot(2,1,2)plot(w,abs(Y)axis(0,pi/6,0,2500);title(解调信号频谱); %画出频谱波形结果:Butterworth Filter Order= 6OmegaC = 0.11717 参考文献1 信号与系统课程组. 信号与系统课程设计指导,2007.102 吴大正. 信号与线性系统分析(第四版). 高等教育出版社,2005.83 谢嘉奎. 电子线路非线性部分(第四版). 高等教育出版社,2003,24 黄永安等.Matlab7.0/Simulink6.0建模仿真开发与高级工程应用. 清华大学出版社,2005.12 5 江建军. LabVIEW程序设计教程. 电子工业出版社, 2008.036张化光,孙秋野.MATLAB/Simulink实用教程. 北京人民邮电出版社,2009