基于matlab的-AM-FM调制与解调报告AM调制与解调100%% AMµ÷ÖÆfigure('Name','Ðźŵ÷ÖÆ¹ý³ÌÖв¨Ðμ°ÆäƵÆ×','NumberTitle','off')a0=1;f0=2000;fc=20000;fs=1000000;t=[1:0.000001:4];am1=0*cos(2*pi*f0*t); %µ÷ÖÆÐźÅam=a0+am1;t1=cos(2*pi*fc*t); %ÔØ²¨s_am=am.*t1;AM1=fft(am1); T1=fft(t1); S_AM=fft(s_am);f=(0:3000000)*fs/3000001-fs/2;subplot(3,2,1); plot(t(1:1000),am1(1:1000)); title('ÐÅÏ¢ÐźŲ¨ÐÎ');subplot(3,2,2); plot(f,fftshift(abs(AM1))); title('ÐÅÏ¢ÐÅºÅÆµÆ×');subplot(3,2,3); plot(t(1:1000),t1(1:1000)); title('ÔØ²¨ÐźÅ');subplot(3,2,4); plot(f,fftshift(abs(T1))); title('ÔØ²¨ÐÅºÅÆµÆ×');subplot(3,2,5); plot(t(1:1000),s_am(1:1000)); title('Òѵ÷ÐźÅ');subplot(3,2,6); plot(f,fftshift(abs(S_AM))); title('Òѵ÷ÐÅºÅÆµÆ×');%²úÉúÔëÉùfigure('Name','Ìí¼ÓÔëÉù¼°´øÍ¨Â˲¨¹ý³Ì²¨Ðμ°ÆäƵÆ×','NumberTitle','off ');snr=5;y=awgn(s_am,snr);fcuts=[16000 17500 22500 24000];mags=[0 1 0];devs=[0.05 0.01 0.05];[n,Wn,beta,ftype]=kaiserord(fcuts,mags,devs,fs);hh=fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');[H,f]=freqz(hh,1,1024,fs);st_p=fftfilt(hh,y);Q=fft(st_p);Y=fft(y);f=(0:3000000)*fs/3000001-fs/2;subplot(2,2,1);plot(t(1500001:1501000),y(1500001:1501000));title('Ìí¼ÓÔëÉùºóÐźŲ¨ÐÎ');subplot(2,2,2);plot(f,fftshift(abs(Y)));title('Ìí¼ÓÔëÉùºóÐÅºÅÆµÆ×');subplot(2,2,3);plot(t(1500001:1501000),st_p(1500001:1501000));title('´øÍ¨Â˲¨ºóÐźŲ¨ÐÎ');subplot(2,2,4); plot(f,fftshift(abs(Q)));title('´øÍ¨Â˲¨ºóÐÅºÅÆµÆ×');%½âµ÷figure('Name','Ïà¸É½âµ÷ËùµÃ²¨Ðμ°ÆäƵÆ×','NumberTitle','off');ss_am=st_p.*t1;SS_AM=fft(ss_am)f=(0:3000000)*fs/3000001-fs/2;subplot(2,1,1);plot(t(1500001:1503000),ss_am(1500001:1503000));title( 'Ïà³ËÐźÅ');subplot(2,1,2); plot(f,fftshift(abs(SS_AM)));title('Ïà³ËÐÅºÅÆµÆ×');fcuts1=[2500,30000];mags1=[1 0];devs1=[0.01 0.05];[n,Wn,beta,ftype]=kaiserord(fcuts1,mags1,devs1,fs);hh1=fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');[H,f]=freqz(hh1,1,1024,fs);m0=fftfilt(hh1,ss_am);M0=fft(m0);f=(0:3000000)*fs/3000001-fs/2;figuresubplot(2,1,1);plot(t(1500001:1501000),m0(1500001:1501000));title('½âµ÷ÐźÅ');subplot(2,1,2); plot(f,fftshift(abs(M0)));title('½âµ÷ÐÅºÅÆµÆ×');11.0005 1.001-101信息信号波形-505x 1050126信息信号频谱11.0005 1.001-101载波信号-505x 1050126载波信号频谱11.00051.001-202已调信号-55x 105012x 106已调信号频谱2.52.50052.501-4-2024添加噪声后信号波形-505x 105051015x 105添加噪声后信号频谱2.52.50052.501-2024带通滤波后信号波形-55x 10500.511.526带通滤波后信号频谱50%% AMµ÷ÖÆ2.5 2.5005 2.501 2.5015 2.502 2.5025 2.503 2.5035-1012相乘信号-5-4-3-2-1012345x 1050510155相乘信号频谱2.52.50012.50022.50032.50042.50052.50062.50072.50082.5009 2.501-0.500.51解调信号-5-4-3-2-1012345x 1050510155解调信号频谱figure('Name','Ðźŵ÷ÖÆ¹ý³ÌÖв¨Ðμ°ÆäƵÆ×','NumberTitle','off')a0=2;f0=2000;fc=20000;fs=1000000;t=[1:0.000001:4];am1=0*cos(2*pi*f0*t); %µ÷ÖÆÐźÅam=a0+am1;t1=cos(2*pi*fc*t); %ÔØ²¨s_am=am.*t1;AM1=fft(am1); T1=fft(t1); S_AM=fft(s_am);f=(0:3000000)*fs/3000001-fs/2;subplot(3,2,1); plot(t(1:1000),am1(1:1000)); title('ÐÅÏ¢ÐźŲ¨ÐÎ');subplot(3,2,2); plot(f,fftshift(abs(AM1))); title('ÐÅÏ¢ÐÅºÅÆµÆ×');subplot(3,2,3); plot(t(1:1000),t1(1:1000)); title('ÔØ²¨ÐźÅ');subplot(3,2,4); plot(f,fftshift(abs(T1))); title('ÔØ²¨ÐÅºÅÆµÆ×');subplot(3,2,5); plot(t(1:1000),s_am(1:1000)); title('Òѵ÷ÐźÅ');subplot(3,2,6); plot(f,fftshift(abs(S_AM))); title('Òѵ÷ÐÅºÅÆµÆ×');%²úÉúÔëÉùfigure('Name','Ìí¼ÓÔëÉù¼°´øÍ¨Â˲¨¹ý³Ì²¨Ðμ°ÆäƵÆ×','NumberTitle','off ');snr=5;y=awgn(s_am,snr);fcuts=[16000 17500 22500 24000];mags=[0 1 0];devs=[0.05 0.01 0.05];[n,Wn,beta,ftype]=kaiserord(fcuts,mags,devs,fs);hh=fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');[H,f]=freqz(hh,1,1024,fs);st_p=fftfilt(hh,y);Q=fft(st_p);Y=fft(y);f=(0:3000000)*fs/3000001-fs/2;subplot(2,2,1);plot(t(1500001:1501000),y(1500001:1501000));title('Ìí¼ÓÔëÉùºóÐźŲ¨ÐÎ');subplot(2,2,2);plot(f,fftshift(abs(Y)));title('Ìí¼ÓÔëÉùºóÐÅºÅÆµÆ×');subplot(2,2,3);plot(t(1500001:1501000),st_p(1500001:1501000));title('´øÍ¨Â˲¨ºóÐźŲ¨ÐÎ');subplot(2,2,4); plot(f,fftshift(abs(Q)));title('´øÍ¨Â˲¨ºóÐÅºÅÆµÆ×');%½âµ÷figure('Name','Ïà¸É½âµ÷ËùµÃ²¨Ðμ°ÆäƵÆ×','NumberTitle','off');ss_am=st_p.*t1;SS_AM=fft(ss_am)f=(0:3000000)*fs/3000001-fs/2;subplot(2,1,1);plot(t(1500001:1503000),ss_am(1500001:1503000));title( 'Ïà³ËÐźÅ');subplot(2,1,2); plot(f,fftshift(abs(SS_AM)));title('Ïà³ËÐÅºÅÆµÆ×'); fcuts1=[2500,30000];mags1=[1 0];devs1=[0.01 0.05];[n,Wn,beta,ftype]=kaiserord(fcuts1,mags1,devs1,fs);hh1=fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');[H,f]=freqz(hh1,1,1024,fs);m0=fftfilt(hh1,ss_am);M0=fft(m0);f=(0:3000000)*fs/3000001-fs/2;figuresubplot(2,1,1);plot(t(1500001:1501000),m0(1500001:1501000));title('½âµ÷ÐźÅ');subplot(2,1,2); plot(f,fftshift(abs(M0)));title('½âµ÷ÐÅºÅÆµÆ×');11.0005 1.001-101信息信号波形-505x 1050126信息信号频谱11.0005 1.001-101载波信号-505x 1050126载波信号频谱11.00051.001-505已调信号-55x 105024x 106已调信号频谱2.52.50052.501-505添加噪声后信号波形-505x 1050123x 106添加噪声后信号频谱2.52.50052.501-4-2024带通滤波后信号波形-55x 105012346带通滤波后信号频谱0%% AMµ÷ÖÆ2.5 2.5005 2.501 2.5015 2.502 2.5025 2.503 2.5035-10123相乘信号-5-4-3-2-1012345x 10501236相乘信号频谱2.52.50012.50022.50032.50042.50052.50062.50072.50082.5009 2.50100.511.5解调信号-5-4-3-2-1012345x 10501236解调信号频谱figure('Name','Ðźŵ÷ÖÆ¹ý³ÌÖв¨Ðμ°ÆäƵÆ×','NumberTitle','off')a0=10^100;f0=2000;fc=20000;fs=1000000;t=[1:0.000001:4];am1=0*cos(2*pi*f0*t); %µ÷ÖÆÐźÅam=a0+am1;t1=cos(2*pi*fc*t); %ÔØ²¨s_am=am.*t1;AM1=fft(am1); T1=fft(t1); S_AM=fft(s_am);f=(0:3000000)*fs/3000001-fs/2;subplot(3,2,1); plot(t(1:1000),am1(1:1000)); title('ÐÅÏ¢ÐźŲ¨ÐÎ');subplot(3,2,2); plot(f,fftshift(abs(AM1))); title('ÐÅÏ¢ÐÅºÅÆµÆ×');subplot(3,2,3); plot(t(1:1000),t1(1:1000)); title('ÔØ²¨ÐźÅ');subplot(3,2,4); plot(f,fftshift(abs(T1))); title('ÔØ²¨ÐÅºÅÆµÆ×');subplot(3,2,5); plot(t(1:1000),s_am(1:1000)); title('Òѵ÷ÐźÅ');subplot(3,2,6); plot(f,fftshift(abs(S_AM))); title('Òѵ÷ÐÅºÅÆµÆ×');%²úÉúÔëÉùfigure('Name','Ìí¼ÓÔëÉù¼°´øÍ¨Â˲¨¹ý³Ì²¨Ðμ°ÆäƵÆ×','NumberTitle','off ');snr=5;y=awgn(s_am,snr);fcuts=[16000 17500 22500 24000];mags=[0 1 0];devs=[0.05 0.01 0.05];[n,Wn,beta,ftype]=kaiserord(fcuts,mags,devs,fs);hh=fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');[H,f]=freqz(hh,1,1024,fs);st_p=fftfilt(hh,y);Q=fft(st_p);Y=fft(y);f=(0:3000000)*fs/3000001-fs/2;subplot(2,2,1);plot(t(1500001:1501000),y(1500001:1501000));title('Ìí¼ÓÔëÉùºóÐźŲ¨ÐÎ');subplot(2,2,2);plot(f,fftshift(abs(Y)));title('Ìí¼ÓÔëÉùºóÐÅºÅÆµÆ×');subplot(2,2,3);plot(t(1500001:1501000),st_p(1500001:1501000));title('´øÍ¨Â˲¨ºóÐźŲ¨ÐÎ');subplot(2,2,4); plot(f,fftshift(abs(Q)));title('´øÍ¨Â˲¨ºóÐÅºÅÆµÆ×');%½âµ÷figure('Name','Ïà¸É½âµ÷ËùµÃ²¨Ðμ°ÆäƵÆ×','NumberTitle','off');ss_am=st_p.*t1;SS_AM=fft(ss_am)f=(0:3000000)*fs/3000001-fs/2;subplot(2,1,1);plot(t(1500001:1503000),ss_am(1500001:1503000));title( 'Ïà³ËÐźÅ');subplot(2,1,2); plot(f,fftshift(abs(SS_AM)));title('Ïà³ËÐÅºÅÆµÆ×'); fcuts1=[2500,30000];mags1=[1 0];devs1=[0.01 0.05];[n,Wn,beta,ftype]=kaiserord(fcuts1,mags1,devs1,fs);hh1=fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');[H,f]=freqz(hh1,1,1024,fs);m0=fftfilt(hh1,ss_am);M0=fft(m0);f=(0:3000000)*fs/3000001-fs/2;figuresubplot(2,1,1);plot(t(1500001:1501000),m0(1500001:1501000));title('½âµ÷ÐźÅ');subplot(2,1,2); plot(f,fftshift(abs(M0)));title('½âµ÷ÐÅºÅÆµÆ×');11.0005 1.001-101信息信号波形-505x 1050126信息信号频谱1 1.0005 1.001-101载波信号-505x 1050126载波信号频谱11.00051.001-101x 10100已调信号-55x 105012x 10106已调信号频谱2.52.5005 2.501-1-0.500.51x 10100添加噪声后信号波形-505x 105051015x 10105添加噪声后信号频谱2.52.5005 2.501-2-1012100带通滤波后信号波形-55x 10501106带通滤波后信号频谱FM 调制与解调%%FMfigure('Name','FMµ÷ÖÆ²¨ÐÎÓëÆµÆ×')2.5 2.5005 2.501 2.5015 2.502 2.5025 2.503 2.5035-50510x 1099相乘信号-5-4-3-2-1012345x 105051015105相乘信号频谱2.52.50012.50022.50032.50042.50052.50062.50072.50082.5009 2.5013.93.913.923.93x 1099解调信号-1-0.500.51x 105123105解调信号频谱f0=2000; fc=20000; fs=1000000; Am=1; kf=0.5; Tc=8; Ta=0.001; dt=0.000001;t=[0:1/fs:3];f=(0:length(t)-1)*fs/(length(t))-fs/2;fm0=cos(2*pi*f0*t);mt=fm0;%»ý·ÖÆ÷Éè¼Æw1=0;w2=0;for m=1:length(t)w1=mt(m)+w2;w2=mt(m)+w1;fi(m)=w1/(2*fs);endfi=fi*2*pi/max(abs(fi));I=cos(kf*fi);Q=sin(kf*fi);y1=Am*cos(2*pi*fc*t).*I-Am*sin(2*pi*fc*t).*Q;subplot(2,1,1);plot(t,y1);title('²¨ÐÎ')axis([1e-3 4e-3 -2 2]);Y1=fft(y1);subplot(2,1,2);plot(f,fftshift(abs(Y1))/1e6); title('ƵÆ×') %%ÔØ²¨ÆµÆ×axis([-4e4 4e4 0 1]);figure('Name','FMµ÷ÖÆºó¼ÓÔëÉù²¨ÐÎÓë½âµ÷ºó²¨ÐÎÒÔ¼°Â˳ýÖ±Á÷·ÖÁ¿ºóµÄ²¨ÐÎ')y1o=awgn(y1,40);subplot(3,1,1);plot(t,y1o); title('¼ÓÔëÉùºó²¨ÐÎ') %%¼ÓÔëÉùºóµÄÐźÅaxis([1e-3 4e-3 -2 2]);%%´øÍ¨Â˲¨KSband=2*(3+1)*f0;fcutsb=[fc-KSband-2000 fc-KSband fc+KSbandfc+KSband+2000]; %%½ÓÊÕ»úǰ¶Ë´øÍ¨Â˲¨magsb=[0 1 0];devsb=[0.05 0.01 0.05];[nb,Wnb,betab,ftypeb]=kaiserord(fcutsb,magsb,devsb,fs);hhb=fir1(nb,Wnb,ftypeb,kaiser(nb+1,betab),'noscale'); %´øÍ¨Â˲¨Æ÷£»st_pb=fftfilt(hhb,y1o);subplot(3,1,2);st_pb=st_pb/1e6;plot(t,st_pb); title('´øÍ¨Â˲¨Æ÷ºóµÄ²¨ÐÎ')axis([1e-3 4e-3 -2e-6 2e-6]);%΢·ÖÆ÷Éè¼Æfor i=1:length(t)-1 %½ÓÊÕÐźÅͨ¹ý΢·ÖÆ÷´¦Àídiff_st_pb(i)=(st_pb(i+1)-st_pb(i))/dt;endsfm=abs(hilbert(diff_st_pb));subplot(3,1,2);plot(t,[sfm*20 0]);axis([1e-3 4e-3 0 4]);%%¸ôÖ±% KSbandh=2*(3+1)*f0;fcutsh=[0.01 3000];magsh=[0 1];devsh=[0.01 0.05];[nh,Wnh,betah,ftypeh]=kaiserord(fcutsh,magsh,devsh,fs);hhh=fir1(nh,Wnh,ftypeh,kaiser(nh+1,betah),'noscale');sfm_out=fftfilt(hhh,sfm*20);subplot(3,1,3);plot(t,[sfm_out 0]);title('¸ôÖ±ºóµÄ²¨ÐÎ')axis([1e-3 4e-3 -2 2]);11.522.533.54x 10-3-2-1012波形-4-3-2-101234x 10400.51频谱11.522.533.54x 10-3-202加噪声后波形11.522.53 3.54x 10-302411.522.533.54x 10-3-202隔直后的波形。