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

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);

结果截图

在这里插入图片描述

在这里插入图片描述

  • 40
    点赞
  • 288
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值