gusucode.com > matlab通信工程仿真源码(张德丰等编著)程序书籍 > matlab_code/matlab通信工程仿真源码(张德丰等编著)/第8章/li8_4.m
clear all; t=0.15; %信号保持时间 ts=0.001; %采样时间间隔 fc=250; %载波频率 fs=1/ts; %采样频率 df=0.3; %频率分辨率 t1=[0:ts:t]; %时间矢量 m=[ones(1,t/(3*ts)),-2*ones(1,t/(3*ts)),zeros(1,t/(3*ts)+1)]; %定义信号序列 y=cos(2*pi*fc.*t1); %载波信号 u=m.*y; %调制信号 [n,m,df1]=fftseq(m,ts,df); %傅里叶变换 [ub,u,df1]=fftseq(u,ts,df); [Y,y,df1]=fftseq(y,ts,df); f=[0:df1:df1*(length(m)-1)]-fs/2; %频率矢量 subplot(221); plot(t1,m(1:length(t1))); %未解调信号 title('未调制信号'); subplot(222); plot(t1,u(1:length(t1))); %解调信号 title('调制信号'); subplot(223); plot(f,abs(fftshift(n))); %未解调信号信号频谱 title('未调制信号频谱'); subplot(224); plot(f,abs(fftshift(ub))); %解调信号信号频谱 title('以调信号频谱');