%信息先调制成BPSK信号,之后讲BPSK信号模拟相位调制的方式加调到中频信号上 %本程序模拟从中频上模拟相位解调得到BPSK信号 clear close all clc fs=100; fc=10; fsig=2; t=0:1/fs:100; t(length(t))=[]; phase_error=pi; carrier_offset=0.01; r=[ones(1,10);-1*ones(1,10)]; r=reshape(r,1,20); r=repmat(r,length(t)/length(r),1); r=reshape(r,1,length(t)); sig=cos(2*pi*fsig*t); sig=sig.*r; mod_sig=pmmod(sig,fc,fs,1); demod_sig=pmdemod(mod_sig,fc*(1+carrier_offset),fs,1,phase_error); figure plot(t,sig,t,demod_sig); axis([2 4 min(demod_sig)*1.1 max(demod_sig)*1.1]); d_sig=demod_sig(2:length(demod_sig))-demod_sig(1:length(demod_sig)-1); figure plot(t(2:length(t)),d_sig); filter_sig=medfilt1(d_sig,3); figure plot(t(2:length(t)),filter_sig); Fpass=4; Fstop=5; Apass=1; Astop=60; Fs=100; h=fdesign.lowpass('fp,fst,ap,ast',Fpass,Fstop,Apass,Astop,Fs); Hlp=design(h,'equiripple',... 'MinOrder','any',... 'StopbandShape','flat'); hlp_sig=filter(Hlp,d_sig); figure plot(t(2:length(t)),hlp_sig); hlp_sig2=filter(Hlp,filter_sig); figure plot(t(2:length(t)),hlp_sig2);