f=-fs/2:df:fs/2-df; subplot(5,1,1)
plot(t,msg2) title('消息信号')
fc=250; s1=0.5*msg2.*cos(2*pi*fc*t); hmsg=imag(hilbert(msg2)); s2=0.5*hmsg.*sin(2*pi*fc*t); Sussb=s1-s2; y=Sussb.*sin(2*pi*fc*t); Y=fft(y)./fs; f_stop=300; n_stop=floor(f_stop/df);
Hlow=zeros(size(f)); Hlow(1:n_stop)=4;
Hlow(length(f)-n_stop+1:end)=4; DEM=Y.*Hlow; dem=real(ifft(DEM))*fs; subplot(5,1,2) plot(t,dem);
title('无噪声的解调信号')
y11=awgn(Sussb,15,'measured'); y12=y11.*sin(2*pi*fc*t); Y12=fft(y12)./fs; DEM1=Y12.*Hlow; dem1=real(ifft(DEM1))*fs; subplot(5,1,3) plot(t,dem1)
title('信噪比为15dB时的解调信号') y21=awgn(Sussb,20,'measured'); y22=y21.*sin(2*pi*fc*t); Y22=fft(y22)./fs; DEM2=Y22.*Hlow; dem2=real(ifft(DEM2))*fs; subplot(5,1,4) plot(t,dem2)
title('信噪比为20dB时的解调信号') y31=awgn(Sussb,25,'measured'); y32=y31.*sin(2*pi*fc*t); Y32=fft(y32)./fs; DEM3=Y32.*Hlow; dem3=real(ifft(DEM3))*fs; subplot(5,1,5) plot(t,dem3)
title('信噪比为25dB时的解调信号') xlabel('李啊兴')
项目7、用Simulink重做项目5。
二)、调频
项目8、用FM重做项目5 clear all
ts=0.001; t=0:ts:20-ts; fs=1/ts; df=fs/length(t); msg2=sinc(t-10);
Pm=fft(msg2)/fs; f=-fs/2:df:fs/2-df; subplot(5,1,1)
plot(t,msg2) title('消息信号')
int_msg(1)=0; for ii=1:length(t)-1
int_msg(ii+1)=int_msg(ii)+msg2(ii)*ts; end
kf=50;fc=250; Sfm=sin(2*pi*fc*t+2*pi*kf*int_msg);
phase=angle(hilbert(Sfm).*exp(-j*2*pi*fc*t));
phi=unwrap(phase); dem=(1/(2*pi*kf)*diff(phi)/ts); dem(length(t))=0; subplot(5,1,2) plot(t,dem);
title('无噪声的解调信号')
y1=awgn(Sfm,15,'measured'); y1(find(y1>1))=1; y1(find(y1<-1))=-1;
phase1=angle(hilbert(y1).*exp(-j*2*pi*fc*t)); phi1=unwrap(phase1);
dem1=(1/(2*pi*kf)*diff(phi1)/ts); dem1(length(t))=0; subplot(5,1,3)
plot(t,dem1);title('信噪比为15dB时的解调信号') y2=awgn(Sfm,20,'measured'); y2(find(y2>1))=1; y2(find(y2<-1))=-1;
phase2=angle(hilbert(y2).*exp(-j*2*pi*fc*t)); phi2=unwrap(phase1);
dem2=(1/(2*pi*kf)*diff(phi2)/ts); dem2(length(t))=0; subplot(5,1,4)
plot(t,dem2);title('信噪比为20dB时的解调信号') y3=awgn(Sfm,25,'measured'); y3(find(y3>1))=1; y3(find(y3<-1))=-1;
phase3=angle(hilbert(y3).*exp(-j*2*pi*fc*t)); phi3=unwrap(phase1);
dem3=(1/(2*pi*kf)*diff(phi3)/ts); dem3(length(t))=0; subplot(5,1,5)
plot(t,dem3);title('信噪比为25dB时的解调信号') xlabel('李啊兴')