⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gen_dsb.m

📁 模拟调制信号产生
💻 M
字号:
function [x]=gen_dsb(fc,fs,fx,Ns,m,SNR)
%产生dsb信号
%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;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -