【数字信号调制】BPSK调制+解调【含GUI Matlab源码 644期】

在这里插入图片描述

⛄一、获取代码方式

获取代码方式1:
完整代码已上传我的资源: 【数字信号调制】基于matlab GUI BPSK调制+解调【含Matlab源码 644期】
点击上面蓝色字体,直接付费下载,即可。

获取代码方式2:
付费专栏Matlab信号处理(初级版)

备注:
点击上面蓝色字体付费专栏Matlab信号处理(初级版),扫描上面二维码,付费29.9元订阅海神之光博客付费专栏Matlab信号处理(初级版),凭支付凭证,私信博主,可免费获得1份本博客上传CSDN资源代码(有效期为订阅日起,三天内有效);
点击CSDN资源下载链接:1份本博客上传CSDN资源代码

⛄二、BPSK简介

在这里插入图片描述
1 BPSK调制过程
在这里插入图片描述
在这里插入图片描述
1.1 用旋转向量的角度理解BPSK调制
在这里插入图片描述
在这里插入图片描述
2 频谱效率
二进制相移键控的频谱效率是1bps/hz
计算方法
在这里插入图片描述

3 缺点
频谱效率低,我们要想办法提高频谱效率

⛄三、部分源代码

function varargout = GUI_BPSK(varargin)
% GUI_BPSK MATLAB code for GUI_BPSK.fig
% GUI_BPSK, by itself, creates a new GUI_BPSK or raises the existing
% singleton*.
%
% H = GUI_BPSK returns the handle to a new GUI_BPSK or the handle to
% the existing singleton*.
%
% GUI_BPSK(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in GUI_BPSK.M with the given input arguments.
%
% GUI_BPSK(‘Property’,‘Value’,…) creates a new GUI_BPSK or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before GUI_BPSK_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to GUI_BPSK_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose “GUI allows only one
% instance to run (singleton)”.
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help GUI_BPSK

% Last Modified by GUIDE v2.5 03-Dec-2018 19:45:43

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @GUI_BPSK_OpeningFcn, …
‘gui_OutputFcn’, @GUI_BPSK_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% — Executes just before GUI_BPSK is made visible.
function GUI_BPSK_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to GUI_BPSK (see VARARGIN)

% Choose default command line output for GUI_BPSK
handles.output = hObject;
s=round(rand(1,100)); %生成二进制基带数据并画出基带信号图
N=1:100;
%figure(1);subplot(311);stem(N,s);title(‘基带信号’);grid on;

Ps=1;
M=2; %BPSK星座图
d=sqrt(Ps)*sin(pi/M);
A=[-1,1]*d;
%subplot(312);scatter(real(A),imag(A),‘filled’);title(‘BPSK星座图’);

Maptable=[0;1]; %BPSK格雷码比特映射
for j=1:1:100
for m=1:M
if isequal(s(j),Maptable(m,:))
Qu(j)= m*pi;
x(j)=A(m);
break
end
end
end %基带数据s携带的信息映射到X[n]

Am=1; %载波调制
T=0.0001; fc=6/T;
Smpl=1000;
deltaT=T/Smpl; %连续时间离散化间隔
Ns=5; %画出Ns个符号的波形
t=deltaT:deltaT:Ns*T; %离散时间序列

for j=1:Ns
index=(j-1)Smpl+1:jSmpl; %第i个符号对应的离散时间序号
g(index)=1; %矩形脉冲成型
X(index)=Amg(index).cos(2pifc*t(index)+Qu(ceil(index/50.01))); %载波调制信号
end

%subplot(313);plot(t,X);title(‘BPSK调制信号波形’);

SNR_dB=15; %定义信噪比
SNR=10^(SNR_dB/10); %定义线性信噪比
Ps=1; %发射功率
Pn=Ps/SNR; %噪声方差
z=sqrt(Pn/2)*(randn(size(x))+randn(size(x))i); %生成白噪声
h=1; %AWGN信道下,信道增益h=1
y=h
x+z; %基带接受信号
%figure(2);subplot(211);scatter(real(y(1:10)),imag(y(1:10)),‘filled’);title(‘BPSK接收星座图’); %y的星座图

for j=1:length(y)
Dist=abs(y(j)-A); %第j个接受信号与各星座图点的距离
[~,Index]=min(Dist); %找到距离最近的点
x_est(j)=A(Index); %得到发射调制信号的估计
s_est(j)=Maptable(Index,:); %得到比特数据的估计
end
W=1:100;
%subplot(212);stem(W,s_est);title(‘BPSK解调后信号’);

for n=1:15
Pe_t(n)=sqrt(2)/4erfc(sqrt(2n));
Pb_t(n)=sqrt(2)/4erfc(sqrt(2n));
end
PESUM=0;
PBSUM=0;
for n=1:15
for m=1:1000
SNR=n;
Ps=1;
Pn=Ps/SNR;
z=sqrt(Pn/2)*(randn(size(x))+randn(size(x))i);
h=1;
y=h
x+z;
for j=1:length(y)
Dist=abs(y(j)-A);
[~,Index]=min(Dist);
x_est(j)=A(Index);
s_est(j)=Maptable(Index,:);
end
for k=1:100
if(s(k)+s_est(k)==1)
PBSUM=PBSUM+1;
end
end
for k1=1:100
if isequal(x(k1),x_est(k1))
PESUM=PESUM+0;
else
PESUM=PESUM+1;
end
end

end
Pe(n)=PESUM/1000/100;
Pb(n)=PBSUM/1000/100;
PESUM=0;
PBSUM=0;
end

SNRX=1:15;
%figure(3);plot(SNRX,Pb); hold on;plot(SNRX,Pe);
%scatter(SNRX,Pe_t);scatter(SNRX,Pb_t, ‘filled’);xlabel(‘信噪比 SNR(r/dB)’);title(‘AWGN信道下误码率与误符号率曲线’);
%axis([1 15 0 0.15]);grid on;hold off;

H=sqrt(1/2)(randn+irandn);
Y=H*x+z;
%figure(4);subplot(211);scatter(real(Y(1:10)),imag(Y(1:10)),‘filled’);title(‘BPSK信道均衡前星座图’);

Y1=Y/H;
%subplot(212);scatter(real(Y1(1:10)),imag(Y1(1:10)),‘filled’);title(‘BPSK信道均衡后星座图’);

PESUM1=0;
PBSUM1=0;
for n=1:15
for m=1:1000
SNR=n;
Ps=1;
Pn=Ps/SNR;
z=sqrt(Pn/2)*(randn(size(x))+randn(size(x))i);
Y1=(H
x+z)/H;
for j=1:length(Y1)
Dist=abs(Y1(j)-A);
[~,Index]=min(Dist);
x_est1(j)=A(Index);
s_est1(j)=Maptable(Index,:);
end
for k=1:100
if(s(k)+s_est1(k)==1)
PBSUM1=PBSUM1+1;
end
end
for k1=1:100
if isequal(x(k1),x_est1(k1))
PESUM1=PESUM1+0;
else
PESUM1=PESUM1+1;
end
end

end
Pe1(n)=PESUM1/1000/100;
Pb1(n)=PESUM1/1000/100;
PESUM1=0;
PBSUM1=0;
end

⛄四、运行结果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

⛄五、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 沈再阳.精通MATLAB信号处理[M].清华大学出版社,2015.
[2]高宝建,彭进业,王琳,潘建寿.信号与系统——使用MATLAB分析与实现[M].清华大学出版社,2020.
[3]王文光,魏少明,任欣.信号处理与系统分析的MATLAB实现[M].电子工业出版社,2018.

3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Matlab领域

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值