matlab对信号进行DSB调制与解调(仿真)

    xiaoxiao2022-07-02  79

    DSB (抑制载波双边带)

    原理笔者不过多赘述,通信原理教材都有详细介绍,直接上干货

    %AM调制信号的MATLAB实现 dt=0.001; %时间采样频谱 Fs=100; fm=1; %信源的最高频率 fc=10; %载波中心频率 T=4; %信号时长 N=T/dt; %采样点个数 t=[0:N-1]*dt; %采样点的时间序列 wc=2*pi*fc; mt=cos(2*pi*t); %信源 figure(1); subplot(311); plot(t,mt); title('基带调制信号'); axis([0 4 -1.5 1.5]); line([0,4],[0,0],'color','k'); %mt的最大值是1 Fc=cos(wc*t); sam=mt.*cos(wc*t); subplot(312); plot(t,Fc); title('载波信号'); axis([0 4 -1.5 1.5]); line([0,4],[0,0],'color','k'); subplot(313); plot(t,sam); hold on; %画出AM信号波形 plot(t,mt,'r--'); title('DSB调制信号及其包络'); axis([0 4 -1.5 1.5]); line([0,4],[0,0],'color','k'); %相干解调 figure(2); subplot(211); st=sam.*cos(wc*t); plot(t,st); title('调制信号与载波信号相乘'); axis([0 4 -1.5 1.5]); line([0,4],[0,0],'color','k'); [f,sf]=T2F(t,st);%傅里叶变换 [t,st1]=lpf(f,sf,2*fm);%低通滤波 subplot(212) plot(t,st1); title('经过低通滤波的相干解调信号波形'); axis([0 4 -1.5 1.5]); line([0,4],[0,0],'color','k');

    子函数

    时域转频域

    function [f,sf]= T2F(t,st) % dt = t(2)-t(1); T=t(end); df = 1/T; N = length(st); f=-N/2*df : df : N/2*df-df; sf = fft(st); sf = T/N*fftshift(sf);

    低通滤波器

    function[t,st]=lpf(f,sf,B) df=f(2)-f(1); fN=length(f); ym=zeros(1,fN); xm=floor(B/df); xm_shift=[-xm:xm-1]+floor(fN/2); ym(xm_shift)=1; yf=ym.*sf; [t,st]=F2T(f,yf);

    频域转时域

    function[t,st]=F2T(f,Sf) df=f(2)-f(1); fmax=(f(end)-f(1)+df); dt=1/fmax; N=length(f); t=[0:N-1]*dt; Sf=fftshift(Sf); st=fmax*ifft(Sf); st=real(st);

    结果截图

    最新回复(0)