%以上边带解调为例
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);
b=sin(2*pi*Fc.*t);
u=m.*c-imag(hilbert(m)).*b;
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;
%//////////////////////////////////////////////////////////
%SSB已调信号解调
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;
%调制信号的功率.
W=1*t0/3+4*t0/3;
P=W/(2*t0/3)
%////////////////////////////////////////////////////////
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('已调制信号频谱');