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

用matlab仿真AM模拟调制、解调过程

AM调制与解调过程

%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 -4 4]);
line([0,4],[0,0],'color','k');
%mt的最大值是1
A=2;
Fc=A.* cos(wc * t);

sam=(A+mt). * cos(wc*t);
subplot(312);
plot(t,Fc);
title('载波信号');
axis([0 4 -4 4]);
line([0,4],[0,0],'color','k');

subplot(313);
plot(t,sam);
hold on;    %画出AM信号波形
plot(t,A+mt,'r--');
title('AM调制信号及其包络 A=2');
axis([0 4 -4 4]);
line([0,4],[0,0],'color','k');

%相干解调
figure(2);
subplot(311);
st=sam.* cos(wc*t);
plot(t,st);
title('调制信号与载波信号相乘');
axis([0 4 -4 4]);
line([0,4],[0,0],'color','k');

[f,sf]=T2F(t,st);%傅里叶变换
[t,st]=lpf(f,sf,2 * fm);%低通滤波
subplot(212)
plot(t,st);
title('经过低通滤波的相干解调信号波形');
axis([0 4 -4 4]);
line([0,4],[0,0],'color','k');

子函数程序 T2F

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

子函数程序 F2T

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

子函数程序 lpf

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

结果如下所示

在这里插入图片描述在这里插入图片描述

  • 48
    点赞
  • 385
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值