我是靠谱客的博主 迷路中心,这篇文章主要介绍基于MATLAB的模拟调制信号与解调的仿真——DSB,现在分享给大家,希望可以做个参考。

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

       DSB——双边带调制

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);

 

最后

以上就是迷路中心最近收集整理的关于基于MATLAB的模拟调制信号与解调的仿真——DSB的全部内容,更多相关基于MATLAB内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(101)

评论列表共有 0 条评论

立即
投稿
返回
顶部