当前位置:网站首页>基于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 % 制度增益
运行结果:



边栏推荐
- Smart headline: smart clothing forum will be held on August 4, and the whole house smart sales will exceed 10billion in 2022
- 【HiFlow】定期发送腾讯云短信发送群
- [ctfhub] the data of JWT header and payload are transmitted in clear text. If sensitive information is contained in it, sensitive information will be leaked. Try to find the flag. Format is flag{}
- Part I basic information of the project
- Idea five free plug-ins to improve efficiency
- 任务切换的细节
- centos7 中彻底卸载mysql
- ERP管理系统在装备制造企业管理中的应用
- [cloud native] install MySQL and redis services in the docker environment
- 《快速掌握QML》第五章 组件
猜你喜欢
随机推荐
[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~
[pyGame practice] playing poker? Win or lose? This card game makes me forget to eat and sleep.
Idea starts multiple projects at once
800V高压快充落地进程加快均胜电子获5亿欧元项目定点
The current situation and history of it migrant workers
Where can I download airserver? How to use tutorial
Find the source code of the thesis
[7.16] code source - [array division] [disassembly] [select 2] [maximum common divisor]
Idea five free plug-ins to improve efficiency
Redis 删除Key命令会导致阻塞么?
【攻防世界WEB】难度三星9分入门题(下):shrine、lottery
MySQL执行顺序
IDEA 提高效率的5大免费插件
C # calculate the number of times a character appears in the string
[hiflow] regularly send Tencent cloud SMS sending group
C语言书写规范
String and integer convert each other
(BFS) template + example (maze, eight digits)
bug修改
aws篇4 一机一密









