(代码)基于MATLAB的AM调制解调系统仿真报告 联系客服

发布时间 : 星期日 文章(代码)基于MATLAB的AM调制解调系统仿真报告更新完毕开始阅读

%-------------------------------------------------------------------- Lfft=length(t);

Lfft=2^ceil(log2(Lfft)+1);

S_am=fftshift(fft(s_am,Lfft)/(length(t))); % fft to”s_am” freqs=(-Lfft/2:Lfft/2-1)/(Lfft*ts); %frequency range

%-------------------------------------------------------------------- %Display the Time_domain &Frequency_domain waveform of message_signal %-------------------------------------------------------------------- figure(1); h1=plot(t,m_sig); %title('Message Signal'); xlabel('t(sec)');ylabel('m(t)'); axis([-0.025 0.025 -2 2]); set(h1,'Linewidth',1.5); figure(2);

h2=plot(freqm,abs(M_fre)); %title('Message Spectrum'); xlabel('f(Hz)');ylabel('M(f)'); axis([-200 200 0 0.5]); set(h2,'Linewidth',1.5);

%-------------------------------------------------------------------- % Display the Time_domaim&Frequency_domain waveform Of Carrier %-------------------------------------------------------------------- figure(3);

S_carr=fftshift(fft(s_carr,Lfft)/(length(t))); h3=plot(freqs,abs(S_carr)); %title('Carrier Spectrum');

xlabel('f(Hz)');ylabel('{\\it S}_{\\it carr}({\\it f})'); axis([-700 700 0 0.5]);set(h3,'Linewidth',1.5); figure(4);

h33=plot(t,s_carr); %title('Carrier Signal');

xlabel('t(sec)');ylabel('{\\it s}_{carr}({\\it t})'); axis([-0.005 0.005 -1.5 1.5]);set(h33,'Linewidth',1.5);

%-------------------------------------------------------------------- %Display the Time_domain &Frequency_domain wave of AM Dodulatied_signal %-------------------------------------------------------------------- figure(5);

h4=plot(t,s_am);xlabel('t(sec)');ylabel('{\\it s}_{\\it AM}({\\it t})'); %title('AM Modulated Signal');

axis([-0.025 0.025 -2 2]);set(h4,'Linewidth',1.5);

figure(6);

%S_am is given before

h5=plot(freqs,abs(S_am));xlabel('f(Hz)');ylabel('{\\it S}_{\\it AM}({\\it f})');

%title('AM Specturm');

axis([-700 700 0 0.5]);set(h5,'Linewidth',1.5);

%-------------------------------------------------------------------- % Demodulation begins by using the coherent_demodulation

%-------------------------------------------------------------------- s_dem=s_am.*s_carr;

S_dem=fftshift(fft(s_dem,Lfft)/(length(t)));

%-------------------------------------------------------------------- %Using the ideal LPF with bandwidth 150Hz

%--------------------------------------------------------------------

s_rec=filter(h,1,s_dem);

S_rec=fftshift(fft(s_rec,Lfft)/(length(t)));

%-------------------------------------------------------------------- %Display the Time_domain &Frequency_domain wave of Coherent_signal %-------------------------------------------------------------------- figure(7);

h6=plot(t,s_dem);xlabel('t(sec)');ylabel('{\\it s}_{\\it rect}({\\it t})');

%title('Cohernet Signal');

axis([-0.025 0.025 -2 2]);set(h6,'Linewidth',1.5); figure(8);

h7=plot(freqs,abs(S_dem));xlabel('f(Hz)');ylabel('{\\it S}_{\\it rect}({\\it f})');

%title('Coherent Specturm');

axis([-1200 1200 0 0.5]);set(h7,'Linewidth',1.5);

%-------------------------------------------------------------------- %Display the Time_domain &Frequency_domain wave of Rcecovered_signal %-------------------------------------------------------------------- figure(9);

h8=plot(t,s_rec);xlabel('t(sec)');ylabel('{\\it s}_{\\it rec}({\\it t})');

%title('Recovered Signal');

axis([-0.025 0.025 -0.5 1]);set(h8,'Linewidth',1.5); figure(10);

h9=plot(freqs,abs(S_rec));xlabel('f(Hz)');ylabel('{\\it S}_{\\it rec}({\\it f})');

%title('Recovered Specturm');

axis([-200 200 0 0.5]);set(h9,'Linewidth',1.5);

%-------------------------------------------------------------------- % Display all time_domain wave on one figure(10)

%-------------------------------------------------------------------- region1=[-0.025 0.025 -2 2 ]; figure(11); subplot(221);

h_1=plot(t,m_sig);title('Message

Signal');xlabel('t(sec)');ylabel('m(t)'); set(h_1,'Linewidth',1.5); grid on; axis(region1); subplot(222);

h_2=plot(t,s_am);xlabel('t(sec)');ylabel('{\\it s}_{\\it AM}({\\it t})'); title('AM Modulated Signal');

set(h_2,'Linewidth',1.5);axis(region1); grid on; subplot(223);

h_3=plot(t,s_dem);xlabel('t(sec)');ylabel('{\\it s}_{\\it rect}({\\it t})');

title('Rectified Signal');

axis(region1);set(h_3,'Linewidth',1.5); grid on; subplot(224);

h_4=plot(t,s_rec);xlabel('t(sec)');ylabel('{\\it s}_{\\it rec}({\\it t})');

title('Recovered Signal');

axis([-0.025 0.025 -0.5 1]);set(h_4,'Linewidth',1.5); grid on;

%-------------------------------------------------------------------- %Display all Frequency_domain wave on one figure(11)

%-------------------------------------------------------------------- region2=[-700 700 0 0.5]; figure(12); subplot(221);

h_5=plot(freqm,abs(M_fre));title('Message Spectrum');xlabel('f(Hz)');ylabel('M(f)');

axis([-200 200 0 0.5]);set(h_5,'Linewidth',1.5); grid on; subplot(222);

h_6=plot(freqs,abs(S_am));xlabel('f(Hz)');ylabel('{\\it S}_{\\it AM}({\\it f})'); title('AM Specturm');

axis([-700 700 0 0.5]);set(h_6,'Linewidth',1.5); grid on; subplot(223);

h_7=plot(freqs,abs(S_dem));xlabel('f(Hz)');ylabel('{\\it S}_{\\it

rect}({\\it f})');

title('Coherent Specturm');

axis(region2);set(h_7,'Linewidth',1.5,'color','r');grid on; subplot(224);

h_8=plot(freqs,abs(S_rec));xlabel('f(Hz)');ylabel('{\\it S}_{\\it rec}({\\it f})');

title('Recovered Specturm');

axis([-200 200 0 0.5]);set(h_8,'Linewidth',1.5,'color','r');grid on;

%-------------------------------------------------------------------- %save the result to file

%-------------------------------------------------------------------- save AM_mod_demod_yzliu_10_28