clear; clc; close all; Fs=1/0.001; %采样频率 T=1/Fs; %时间间隔 L=1000; %信号长度 fm=50; %基带信号频率 fc=500; %载波频率 t=(0:L-1)*T; m=2*cos(2*pi*fm*t); %基带信号 dsb=m.*cos(2*pi*fc*t); %DSB信号 figure(1) subplot(2,1,1); plot(t,m); title('基带信号'); xlabel('t'); subplot(2,1,2); plot(t,dsb); title('DSB调制信号'); xlabel('t'); %DSB相干解调 r=dsb.*cos(2*pi*fc*t); a=fir1(48,0.1); %产生一个48阶的FIR低通滤波器 [H,w]=freqz(a,1,-2*pi:pi/100:2*pi); figure(2) subplot(2,1,1) plot(w/pi,abs(H)) title('离散系统幅频特性曲线') xlabel('pi');ylabel('幅度') grid on subplot(2,1,2) plot(w/pi,angle(H)) xlabel('pi');ylabel('幅度') grid on title('离散系统相频特性曲线') rt=filter(a,1,r); rt=rt*2; %理论上低通滤波后的信号是1/2*m figure(3) subplot(2,1,1) plot(t,rt); title('相干解调后的信号'); xlabel('t'); NFFT=length(rt); y=fft(rt,NFFT); f=(0:NFFT-1)/NFFT*Fs; subplot(2,1,2) plot(f(1:NFFT/2+1),abs(y(1:NFFT/2+1))*2/NFFT) title('相干解调后的信号的幅度谱'); xlabel('频率');