www.pudn.com > am_jt.rar > sh2_c_jt.m


clear; 
t0=0.15; 
ts=0.001; 
Fc=250; 
snr=20; 
Fs=1/ts; 
df=0.3; 
t=[0:ts:t0]; 
snr_lin=10^(snr/10); 
m=[ones(1,t0/(3*ts)),-2*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)]; 
c=cos(2*pi*Fc.*t); 
a=0.3; 
m_n=m/max(abs(m));%归一化 
u=(1+a*m_n).*c; 
y=u.*c; 
[M,m,df1]=fft_seq(m,ts,df); 
M=M/Fs; 
[U,u,df1]=fft_seq(u,ts,df); 
U=U/Fs; 
[Y,y,df1]=fft_seq(y,ts,df); 
Y=Y/Fs; 
[C,c,df1]=fft_seq(c,ts,df); 
f=[0:df1:df1*(length(m)-1)]-Fs/2; 
%////////////////////////////////////////////////////////// 
%AM已调信号解调 
f_cutoff=150; 
n_cutoff=floor(150/df1); 
f=[0:df1:df1*(length(y)-1)]-Fs/2; 
H=zeros(size(f)); 
H(1:n_cutoff)=2*ones(1,n_cutoff); 
H(length(f)-n_cutoff+1:length(f))=2*ones(1,n_cutoff); 
DEM=H.*Y; 
dem=real(ifft(DEM))*Fs; 
dem=(dem-1)*2./a; 
%调制信号的功率. 
W=1*t0/3+4*t0/3; 
P=W/(2*t0/3) 
%得到P = 
%    2.5000 
%//////////////////////////////////////////////////////// 
clf 
subplot(2,2,1);plot(t,m(1:length(t))); 
title('未调制信号'); 
subplot(2,2,2);plot(t,u(1:length(t))); 
title('已调制信号'); 
subplot(2,2,3);plot(t,dem(1:length(t))); 
title('解调波形'); 
subplot(2,2,4);plot(f,abs(fftshift(U))); 
title('已调制信号频谱');