基于MATLAB的模拟调制信号与解调的仿真——DSB

本文介绍了一种使用MATLAB实现的双边带调制(DSB)与解调的仿真方法。通过设置时间采样间隔、信源频率等参数,生成了调制信号与载波信号,并进行了DSB调制。之后,通过与载波信号相乘及低通滤波实现了相干解调。文中提供了完整的MATLAB代码,包括自定义的傅里叶变换和低通滤波函数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

     实现模拟调制信号与解调的仿真是我的MATLAB课程设计的一部分,我参考了网上的一些资料,并加入了一些自己的想法,代码已在本地MATLAB编译通过且能正常运行

       DSB——双边带调制

dt=0.001; %时间采样间隔
fm=1; %信源最高频率
fc=10; %载波中心频率
T=5; %信号时长
t=0:dt:T;
mt=sqrt(2)*cos(2*pi*fm*t); %信源
figure(1)
subplot(311);
plot(t,mt);
title('调制信号')
coss=cos(2*pi*fc*t);
subplot(312);
plot(t,coss);
title('载波信号')
%N0=0.01; %白噪声单边功率谱密度
%DSB调制
s_dsb=mt.*cos(2*pi*fc*t);
B=2*fm;
%noise=noise_nb(fc,B,N0,t);
%s_dsb=s_dsb+noise;

subplot(313)
plot(t,s_dsb); %画出DSB信号波形
hold on
plot (t,mt,'r--'); %标出m(t)波形
hold on
plot(t,-mt,'r--');
title('DSB调制信号');


 %DSB相干解调
rt=s_dsb.*cos(2*pi*fc*t);
figure(2);
subplot(311);
plot(t,rt);
title('DSB调制信号与载波信号相乘')
[f,rf]=T2F(t,rt);%傅里叶变换
[t,rt]=lpf(f,rf,fm);%低通滤波
subplot(312)
plot(t,rt);
title('经过低通滤波的相干解调信号波形');
rt=rt-mean(rt);
subplot(313)
[f,sf]=T2F(t,s_dsb);%傅里叶变换
psf=(abs(sf).^2)/T;
plot(f,psf);
axis([-2*fc 2*fc 0 max(psf)]);
title('DSB信号功率谱');

用到的函数

①T2F.m

function [f,sf]= T2F(t,st)
%利用FFT计算信号的频谱并与信号的真实频谱的抽样比较。
%脚本文件T2F.m定义了函数T2F,计算信号的傅立叶变换。
%This is a function using the FFT function to calculate a signal Fourier
%Translation
%Input is the time and the signal vectors,the length of time must greater
%than 2
%Output is the frequency and the signal spectrum
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);

②lpf.m

function [t,st]=lpf(f,sf,B)
%This function filter an input data using a lowpass filter
%Inputs: f: frequency samples
% sf: input data spectrum samples
% B: lowpass bandwidth with a rectangle lowpass
%Outputs: t: time samples
% st: output data time samples
df = f(2)-f(1);
T = 1/df;
hf = zeros(1,length(f));%全零矩阵
bf = [-floor( B/df ): floor( B/df )] + floor( length(f)/2 );
hf(bf)=1;
yf=hf.*sf;
[t,st]=F2T(f,yf);
st = real(st);

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值