t0=0; ts=0.000001; t1=0.004; fs=1/ts; df=0.25; t=t0:ts:t1; %fs=1000000; N=4000; w=(0:N)*fs/(N+1)-fs/2; m=cos(2*pi*2000*t); figure plot(w,m) title('信號'); N=4000; w=(0:N)*fs/(N+1)-fs/2; Y1=fftshift(abs(fft(m))); figure(2) plot(w,Y1) title('信號頻譜'); axis([-4000,40000,0,2000]) c=cos(2*pi*20000*t); figure(3) plot(w,c) title('載波'); Y2=fftshift(abs(fft(c))); figure(4) plot(w,Y2) title('載波頻譜'); axis([-40000,40000,0,100]) s=m.*c; figure(5) plot(w,s) title('已調信號'); Y3=fftshift(abs(fft(s))); figure(6) plot(w,Y3) title('已調信號頻譜'); axis([-4000,4000,0,2000]) y3= awgn(s,3); subplot(4,1,1); plot(t,y3); title('加噪聲后的已調信號'); fsamp = 1e6; %采樣頻率為1MHz fcuts = [16000 17500 22500 24000]; mags = [0 1 0]; devs = [0.05 0.01 0.05]; [n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,fsamp); hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale'); s1 = fftfilt(hh,y3); subplot(4,1,2); plot(t,s1); title('經帶通濾波后的已調制信號'); s2=c.*s1; subplot(4,1,3); plot(t,s2); title('經乘法器后的已調制信號'); fsamp = 1e6; %采樣頻率為1MHz fcuts = [3000 20000]; %通帶截止頻率為3000Hz,阻帶截止頻率為20000Hz mags = [1 0]; devs = [0.01 0.05]; % 通帶波動1%,阻帶波動5% [n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,fsamp); hh2 = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale'); m0 = fftfilt(hh2,s2); subplot(4,1,4); plot(t,m0); title('經低通濾波后的最后的解調調制信號');






|