?? gen_dsb.m
字號(hào):
function [x]=gen_dsb(fc,fs,fx,Ns,m,SNR)
%產(chǎn)生dsb信號(hào)
%fc:carrier frequency
%fs:sampple frequency
%fx:bandwidth of message signal
%Ns:number of total samplles per segment
%m:modulation depth
%SNR:snr of signal received
luo=0.98;
n=randn(Ns,1);
xm=zeros(Ns,1);
for i=2:Ns
xm(i,:)=luo*xm(i-1)+n(i);
end;
%filt the message signal
Wn=fx/(fs/2);
fir_coef=fir1(30,Wn);
xm=fftfilt(fir_coef,xm);
%adjust the mean of message signal
xm = xm - mean(xm);
%dsb moulation
for i=1:Ns
s(i,1)=xm(i)*cos(2*pi*fc*i/fs);
end
%bandlimitation on modulated signal
Wn=[(fc-fx)/(fs/2),(fc+fx)/(fs/2)];
fir_coef = fir1(30, Wn);
s=fftfilt(fir_coef, s);
%%% adding the bandlimited noise;
n=randn(Ns,1);
Wn2=[(fc-1.2*fx)/(fs/2),(fc+1.2*fx)/(fs/2)];
fir_coef2=fir1(30,Wn2);
n=fftfilt(fir_coef2,n);
%%% function: sig_Rx = AWGN_channel(sig_Tx, fc, bandwidth, SNR, noise_flag);
Sp=sum(s.*conj(s));
Np=sum(n.*conj(n));
Rsn=sqrt(Sp/Np)*10^(-SNR/20);
x=s+Rsn*n;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -