当前位置:网站首页>基于Matlab的SSB信号调制和解调(内附源码)
基于Matlab的SSB信号调制和解调(内附源码)
2022-07-23 11:19:00 【剑轩~】
详细原理可参考课设报告:基于matlab的SSB信号调制、传输、解调的仿真-行业报告文档类资源-CSDN下载
调制采用了滤波法和相移法。
代码中有注释,无子函数,可以直接运行。
压缩包中包含了具体的课设报告,里面有详细的原理说明,运行截图、结果分析等。
matlab代码和运行结果如下:
%信号参数设置
%设置基带信号为100Hz,载波信号为1kHz
fm=100;fc=10^3; %信号频率fm,载波频率fc
Fs=10^4; %采样频率Fs
wc=2*pi*fc;
wm=2*pi*fm;
T = 1/Fs; % 采样间隔
L=2*10^4; % 信号长度
t = (0:L-1)*T ;
f = Fs*(0:(L/2))/L;
%基带信号时域
sm=cos(wm*t);
figure('Name','基带信号');
subplot(211);
plot(t,sm);
title('基带信号时域');
xlabel('t');
axis([0 1 -2 2]);
grid on
%基带信号频域
S1=fft(sm);
P1b=abs(S1/L);
%得到单边
P1a = P1b(1:L/2+1);
P1a(2:end-1) = 2*P1a(2:end-1);
subplot(212);
plot(f,P1a); %SSB信号频域波形
xlabel('Frequency(HZ)');
title('基带信号频域波形 ');
axis([0 150 0 1])
grid on;
%载波信号
sc=cos(wc*t);
figure('Name','载波信号');
subplot(211);
plot(t,sc);
title('载波信号时域');
xlabel('t');
axis([0 1 -2 2]);
grid on
%频域
Sc=fft(sc);
Pcb=abs(Sc/L);
%得到单边
Pca = Pcb(1:L/2+1);
Pca(2:end-1) = 2*Pca(2:end-1);
subplot(212);
plot(f,Pca); %频域波形
xlabel('Frequency(HZ)');
title('载波信号频域波形 ');
axis([500 1500 0 1])
grid on;
%调制
%滤波法
% 先得到一个DSB信号, 即将调制信号与载波信号相乘
s2 = cos(wc*t).*sm;
%频域图
S2=fft(s2);
P2b=abs(S2/L);
%得到单边
P2a = P2b(1:L/2+1);
P2a(2:end-1) = 2*P2a(2:end-1);
figure('name','滤波法');
subplot(211);
plot(f,P2a); %滤波法调制信号频域波形
title('生成的DSB信号');
axis([850 1200 0 1])
% 低通滤波
fp1=[800 1000];fs1=[700 1100];
Fs2=Fs/2;
Wp=fp1/Fs2; Ws=fs1/Fs2;
Rp=1; Rs=30;
[n,Wn]=cheb2ord(Wp,Ws,Rp,Rs);
[b1,a1]=cheby2(n,Rs,Wn);
s3=filter(b1,a1,s2);%经过filter滤波之后得到的数据y则是经过带通滤波后的信号数据
%频域图
S3=fft(s3);
P3b=abs(S3/L);
%得到单边
P3a = P3b(1:L/2+1);
P3a(2:end-1) = 2*P3a(2:end-1);
subplot(212);
plot(f,P3a); %滤波法调制信号频域波形
axis([850 1200 0 1])
title('低通滤波变成SSB信号') ;
grid on ;
%相移法
%SSB调制信号频域
figure('name','相移法');
%使用
s4=modulate(sm,fc,Fs,'amssb')/2; %对调制信号进行调制
S4 = fft(s4);
P4b = abs(S4/L);
%得到单边
P4a = P4b(1:L/2+1);
P4a(2:end-1) = 2*P4a(2:end-1);
plot(f,P4a); %相移法调制信号频域波形
axis([850 1200 0 1])
title('相移法生成SSB信号') ;
grid on;
%模拟传输,对信号进行加噪,将已调信号嵌入方差为 0.1 的高斯白噪声中。
%对信号进行加噪
cur = size(s4);
s5 = s4 + 0.5*randn(size(t));
S5=fft(s5);
P5b = abs(S5/L);
P5a = P5b(1:L/2+1);
P5a(2:end-1) = 2*P5a(2:end-1);
figure('name','传输-加噪');
plot(f,P5a); % 加噪后频域波形
axis([500 1000 0 1])
xlabel('Frequency(HZ)');
title('加噪频域波形 ');
grid on;
% 带通滤波
% 带通范围:890~910Hz
fp1=[899,901];fs1=[890 905];
Fs2=Fs/2;
Wp=fp1/Fs2; Ws=fs1/Fs2;
Rp=1.1; Rs=10;
[n,Wn]=cheb2ord(Wp,Ws,Rp,Rs);
[b1,a1]=cheby2(n,Rs,Wn);
s6=filter(b1,a1,s5); %经过filter滤波之后得到的数据y则是经过带通滤波后的信号数据
S6=fft(s6);
P6b = abs(S6/L);
P6a = P6b(1:L/2+1);
P6a(2:end-1) = 2*P6a(2:end-1);
figure('name','接收-带通滤波')
plot(f,P6a); % 加噪后频域波形
axis([500 1000 0 1])
xlabel('Frequency(HZ)');
title('带通频域波形 ');
grid on;
%解调
figure('name','解调');
subplot(211);
%幅度解调,单边带。乘以 y频率正弦曲线并使用..fc应用五阶巴特沃斯低通滤波器filtfilt
%{
x = y.*cos(2*pi*fc*t);
[b,a] = butter(5,fc*2/fs);
x = filtfilt(b,a,x);
%}
s7=demod(s6,fc,Fs,'amssb'); %对SSB信号进行解调
S7=fft(s7);
P7b = abs(S7/L);
P7a = P7b(1:L/2+1);
P7a(2:end-1) = 2*P7a(2:end-1);
plot(f,P7a); % 解调后频域波形
axis([0 110 0 1])
xlabel('Frequency(HZ)');
title('解调频域波形 ');
grid on;
subplot(212);
plot(t,s7); %解调后的时域波形
title('解调后的时域波形');
xlabel('t');
subplot(2,1,2);
axis([0 1 -2 2]);
grid on;
figure('name','比较调制和解调')
subplot(211) ;
plot(t,sm);
title('基带信号时域');
xlabel('t');
axis([0 1 -2 2]);
subplot(212);
plot(t,s7*4); %解调后的时域波形
title('解调后的时域波形');
xlabel('t');
axis([0 1 -2 2]);
grid on;
%计算系统性能
%SSB_6(fm,sm)
disp('计算系统性能')
%n0 = 5*10^-15 % 定义高斯白噪声的参数n0
%计算系统性能子函数
syms n0
B = fm; % 带宽
Ni = n0*B ;
No = 1/4*Ni;
mo = 1/4*sm;
So = mean(mo.^2);
Si = 1/4*mean(sm.^2);
disp('输入信噪比:')
ans1 = Si./Ni % 输入信噪比
disp('输出信噪比:')
ans2 = So./No % 输出信噪比
disp('制度增益')
Gssb = ans2./ans1 % 制度增益
运行结果:



边栏推荐
- 【Pygame实战】打扑克牌嘛?赢了输了?这款打牌游戏,竟让我废寝忘食。
- The difference between cookies and sessions
- Find the source code of the thesis
- Open source quadruped robot with design drawings and code "suggestions collection"
- IDEA 提高效率的5大免费插件
- 在一个有序数组中查找具体的某个数字(二分查找or折半查找)
- Redis 删除Key命令会导致阻塞么?
- Camera flashlight modification
- JSD-2204-会话管理-过滤器-Day19
- Start other independent programs through fmmonitoredprocess in unreal
猜你喜欢
![[pyGame actual combat] aircraft shooting masterpiece: fierce battle in the universe is imminent... This super classic shooting game should also be taken out and restarted~](/img/a3/087b1bc7445c53ddbd6d7334da51b9.png)
[pyGame actual combat] aircraft shooting masterpiece: fierce battle in the universe is imminent... This super classic shooting game should also be taken out and restarted~

Quickly master QML Chapter 5 components

【攻防世界WEB】难度三星9分入门题(上):simple_js、mfw
[email protected]]#颜色"/>修改ssh命令行[[email protected]]#颜色

Batch deletion with RPM -e --nodeps

Jsd-2204 session management filter day19

备份内容哈哈哈

VSCode 更新後與tab相關快捷鍵無法使用

奔驰新能源产品线:豪华新能源市场或将改变格局

深入理解L1、L2正则化
随机推荐
麒麟V10源码编译qtCreator4.0.3记录
【攻防世界WEB】难度三星9分入门题(下):shrine、lottery
Part III detailed explanation of RBAC authority management database design
Gear 月度更新|6 月
记一次SQL优化
bug修改
The current situation and history of it migrant workers
As a tester, you cannot fail to understand ADB commands and operations
PHP代码审计4—Sql注入漏洞
The exclamation point of vscode +tab shortcut key cannot be used, and the solution to the problem of a-soul-live2d plug-in
备份内容哈哈哈
Camera 手电筒修改
AWS篇1
Where can I download airserver? How to use tutorial
SCA在得物DevSecOps平台上应用
Safety 7.18 operation
第一篇 项目基本情况介绍
没有了华为,高通任意涨价,缺乏核心技术的国产手机只能任由宰割
harbor镜像仓库
Kirin V10 source code compilation qtcreater4.0.3 record