matlab DSB-AM与SSB-AM的调制与解调

题目

在这里插入图片描述

使用matlab自带函数

fft_seq.m文件

function [M,m,df]=fft_seq(m,ts,df)
fs=1/ts;
if nargin==2,n1=0;
else,n1=fs/df;
end;
n2=length(m);
n=2^(max(nextpow2(n1),nextpow2(n2)));
M=fft(m,n);
m=[m,zeros(1,n-n2)];
df=fs/n;
clear all;clc;
%DSB-AM 和SSB-AM调制/解调 (自带函数)
t0=0.15;
ts=0.001;
Fc=250;
Fs=1/ts;
df=0.3;
t=[0:ts:t0];
m=[ones(1,t0/(3*ts)),-2*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)];%定义信号序列
u1=ammod(m,Fc,Fs);%DSB-AM调制信号
y1=amdemod(u1,Fc,Fs); %DSB-AM解调信号

u2=ssbmod(m,Fc,Fs);%SSB-AM调制信号
y2=ssbdemod(u2,Fc,Fs);%SSB-AM解调信号

[M,m,df1]=fft_seq(m,ts,df); %傅里叶变换
M=M/Fs;  %缩放
[U1,u1,df1]=fft_seq(u1,ts,df);
U1=U1/Fs;
[Y1,y1,df1]=fft_seq(y1,ts,df);
Y1=Y1/Fs;

[U2,u2,df1]=fft_seq(u2,ts,df);
U1=U1/Fs;
[Y2,y2,df1]=fft_seq(y2,ts,df);
Y2=Y2/Fs;

f=[0:df1:df1*(length(m)-1)] -Fs/2;
clf;figure(1)

subplot(3,2,1);
plot(t,m(1:length(t)));
title('DSB-AM未调制信号');

subplot(3,2,2);
plot(t,u1(1:length(t)));
title('DSB-AM已调制信号');

subplot(3,2,3);
plot(t,y1(1:length(t)));
title('DSB-AM解调信号');

% subplot(3,2,4);
% plot(f,abs(fftshift(Y1)));
% title('DSB-AM解调信号频谱');


subplot(3,2,5);
plot(f,abs(fftshift(M)));
title('DSB-AM未调制信号频谱');

subplot(3,2,6);
plot(f,abs(fftshift(U1)));
title('DSB-AM已调制信号频谱');


%%%%%%%%%%%%%%%%%%%
figure(2)
subplot(3,2,1);
plot(t,m(1:length(t)));
title('SSB-AM未调制信号');

subplot(3,2,2);
plot(t,u1(1:length(t)));
title('SSB-AM已调制信号');

subplot(3,2,3);
plot(t,y2(1:length(t)));
title('SSB-AM解调信号');

% subplot(3,2,4);
% plot(f,abs(fftshift(Y2)));
% title('SSB-AM解调信号频谱');

subplot(3,2,5);
plot(f,abs(fftshift(M)));
title('SSB-AM未调制信号频谱');

subplot(3,2,6);
plot(f,abs(fftshift(U2)));
title('SSB-AM已调制信号频谱');

效果

在这里插入图片描述

未使用matlab自带的函数

DSB-AM调制与解调

clear all;clc;
%DSB-AM调制与解调 (未使用自带函数)
t0=0.15;
ts=0.001;
Fc=250;
Fs=1/ts;
df=0.3;
t=[0:ts:t0];
m=[ones(1,t0/(3*ts)),-2*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)];%定义信号序列
c=cos(2*pi*Fc.*t); %载波信号
u=m.*c; %调制信号
y=u.*c;

[M,m,df1]=fft_seq(m,ts,df); %傅里叶变换
M=M/Fs;
[U,u,df1]=fft_seq(u,ts,df);
U=U/Fs;
[Y,y,df1]=fft_seq(y,ts,df);
Y=Y/Fs;
f_cutoff=150;
n_cutoff=floor(150/df1);

f=[0:df1:df1*(length(m)-1)] -Fs/2;
H=zeros(size(f));
H(1:n_cutoff)=2*ones(1,n_cutoff);
H(length(f) - n_cutoff + 1:length(f))=2*ones(1,n_cutoff);
DEM=H.*Y;
dem=real(ifft(DEM))*Fs;

subplot(3,2,1);
plot(t,m(1:length(t)));
title('DSB-AM未调制信号');

subplot(3,2,2);
plot(t,u(1:length(t)));
title('DSB-AM已调制信号');

subplot(3,2,3);
plot(t,dem(1:length(t)));
title('DSB-AM解调信号');

subplot(3,2,4);
plot(f,abs(fftshift(DEM))); %解调信号的频谱
title('DSB-AM解调信号频谱');

subplot(3,2,5);
plot(f,abs(fftshift(M)));
title('DSB-AM未调制信号频谱');

subplot(3,2,6);
plot(f,abs(fftshift(U))); %已调制信号频谱
title('DSB-AM已调制信号频谱');


效果

在这里插入图片描述

SSB-AM调制与解调

clear all;clc;
%SSB-AM调制与解调 (未使用自带函数)
t0=0.15;
ts=0.001;
Fc=250;
Fs=1/ts;
df=0.3;
t=[0:ts:t0];
m=[ones(1,t0/(3*ts)),-2*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)];%定义信号序列
c=cos(2*pi*Fc.*t); %载波信号
b=sin(2*pi*Fc.*t);
u=m.*c; %调制信号
y=u.*c;

ussb=m.*c-imag(hilbert(m)).*b; %上边带调制信号
lssb=m.*c+imag(hilbert(m)).*b;  %下边带调制信号

[M,m,df1]=fft_seq(m,ts,df); %傅里叶变换
M=M/Fs;
[U,u,df1]=fft_seq(u,ts,df);
U=U/Fs;
[Y,y,df1]=fft_seq(y,ts,df);
Y=Y/Fs;

[U1,ussb,df1]=fft_seq(ussb,ts,df);
U1=U1/Fs;
[L1,lssb,df1]=fft_seq(lssb,ts,df);
L1=L1/Fs;

f_cutoff=150;
n_cutoff=floor(150/df1);

f=[0:df1:df1*(length(m)-1)] -Fs/2;
H=zeros(size(f));
H(1:n_cutoff)=2*ones(1,n_cutoff);
H(length(f) - n_cutoff + 1:length(f))=2*ones(1,n_cutoff);
DEM=H.*Y;
dem=real(ifft(DEM))*Fs;

subplot(5,2,1);
plot(t,m(1:length(t)));
title('SSB-AM未调制信号');

subplot(5,2,2);
plot(t,u(1:length(t)));
title('SSB-AM已调制信号');

subplot(5,2,3);
plot(t,dem(1:length(t)));
title('SSB-AM解调信号');

subplot(5,2,4);
plot(f,abs(fftshift(DEM))); %解调信号的频谱
title('SSB-AM解调信号频谱');


subplot(5,2,5);
plot(f,abs(fftshift(M)));
title('SSB-AM未调制信号频谱');

subplot(5,2,6);
plot(f,abs(fftshift(U)));
title('SSB-AM已调制信号频谱');

%%%%
subplot(5,2,7);
plot(t,ussb(1:length(t)));
title('SSB-AM上边带调制信号');

subplot(5,2,8);
plot(t,lssb(1:length(t)));
title('SSB-AM下边带调制信号');

subplot(5,2,9);
plot(f,abs(fftshift(U1)));
title('SSB-AM上边带调制信号频谱');

subplot(5,2,10);
plot(f,abs(fftshift(L1)));
title('SSB-AM下边带调制信号频谱');

效果

在这里插入图片描述

  • 2
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
MATLAB中,可以使用以下函数进行AM、DSBSSB、VSB信号的解调: 1. 幅度调制(AM)解调:amdemod函数 ```matlab fc = 1000; %载波频率 fs = 10000; %采样频率 t = 0:1/fs:1; %时间序列 Ac = 1; %载波振幅 Am = 0.5; %调制信号振幅 fm = 10; %调制信号频率 m = Am*cos(2*pi*fm*t); %调制信号 c = Ac*cos(2*pi*fc*t); %载波信号 s = m.*c; %调制信号与载波信号相乘 r = s.*cos(2*pi*fc*t); %接收到的AM信号 y = amdemod(r,fc,fs,'hilbert'); %使用amdemod函数进行解调 ``` 2. 幅度调制(DSB)解调dsbdemod函数 ```matlab fc = 1000; %载波频率 fs = 10000; %采样频率 t = 0:1/fs:1; %时间序列 Ac = 1; %载波振幅 Am = 0.5; %调制信号振幅 fm = 10; %调制信号频率 m = Am*cos(2*pi*fm*t); %调制信号 c = Ac*cos(2*pi*fc*t); %载波信号 s = m.*c; %调制信号与载波信号相乘 r = s.*cos(2*pi*fc*t); %接收到的DSB信号 y = dsbdemod(r,fc,fs); ``` 3. 单边带调制(SSB)解调ssbdemod函数 ```matlab fc = 1000; %载波频率 fs = 10000; %采样频率 t = 0:1/fs:1; %时间序列 Ac = 1; %载波振幅 Am = 0.5; %调制信号振幅 fm = 10; %调制信号频率 m = Am*cos(2*pi*fm*t); %调制信号 c = Ac*cos(2*pi*fc*t); %载波信号 s = m.*c; %调制信号与载波信号相乘 ssb = ssbmod(m,fc,fs); %使用ssbmod函数进行单边带调制 r = ssb.*cos(2*pi*fc*t); %接收到的SSB信号 y = ssbdemod(r,fc,fs,0,'upper'); %使用ssbdemod函数进行解调 ``` 4. 余边抑制调制(VSB)解调:vestigialdemod函数 ```matlab fc = 1000; %载波频率 fs = 10000; %采样频率 t = 0:1/fs:1; %时间序列 Ac = 1; %载波振幅 Am = 0.5; %调制信号振幅 fm = 10; %调制信号频率 m = Am*cos(2*pi*fm*t); %调制信号 c = Ac*cos(2*pi*fc*t); %载波信号 s = m.*c; %调制信号与载波信号相乘 vestigial = vestigialmod(m,fc,fs); %使用vestigialmod函数进行余边抑制调制 r = vestigial.*cos(2*pi*fc*t); %接收到的VSB信号 y = vestigialdemod(r,fc,fs,0.2); %使用vestigialdemod函数进行解调 ``` 以上函数的输出结果都是解调后的信号,可以通过MATLAB的绘图函数进行绘制。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值