【数字信号调制】基于matlab GUI QPSK调制+解调【含Matlab源码 646期】
生活随笔
收集整理的這篇文章主要介紹了
【数字信号调制】基于matlab GUI QPSK调制+解调【含Matlab源码 646期】
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、獲取代碼方式
獲取代碼方式1:
完整代碼已上傳我的資源: 【數字信號調制】基于matlab GUI QPSK調制+解調【含Matlab源碼 646期】
獲取代碼方式2:
通過訂閱紫極神光博客付費專欄,憑支付憑證,私信博主,可獲得此代碼。
備注:訂閱紫極神光博客付費專欄,可免費獲得1份代碼(有效期為訂閱日起,三天內有效);
二、QPSK簡介
1 調制模型
與QPSK相比,OQPSk調制方式在復數通道Q通道中,插入了一個比特的時延Tb。
2.優點
OQPSK能夠把180度的相移變化變成兩個π /2的相位變化,因此相軌道遠離了原點
3 解調
因為調制時Q路進行了延時,所以解調時I路進行延時
三、部分源代碼
function varargout = GUI_QPSK(varargin)
% GUI_QPSK MATLAB code for GUI_QPSK.fig
% GUI_QPSK, by itself, creates a new GUI_QPSK or raises the existing
% singleton*.
%
% H = GUI_QPSK returns the handle to a new GUI_QPSK or the handle to
% the existing singleton*.
%
% GUI_QPSK('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI_QPSK.M with the given input arguments.
%
% GUI_QPSK('Property','Value',...) creates a new GUI_QPSK or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before GUI_QPSK_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to GUI_QPSK_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_QPSK% Last Modified by GUIDE v2.5 03-Dec-2018 20:37:56% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @GUI_QPSK_OpeningFcn, ...'gui_OutputFcn', @GUI_QPSK_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);
if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});
endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
elsegui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT% --- Executes just before GUI_QPSK is made visible.
function GUI_QPSK_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_QPSK (see VARARGIN)% Choose default command line output for GUI_QPSK
handles.output = hObject;
s=round(rand(1,100)); %生成二進制基帶數據并畫出基帶信號圖
N=1:100;
%figure(1);subplot(311);stem(N,s);title('基帶信號');grid on;Ps=1;
M=4; %QPSK星座圖
d=sqrt(Ps)*sin(pi/M);
A=[1+1*i,-1+1*i,-1-1*i,1-1*i]*d;
%subplot(312);scatter(real(A),imag(A),'filled');title('QPSK星座圖');hold on;
theta=0:pi/100:2*pi;
x=cos(theta);
y=sin(theta);
%plot(x,y);grid on; Maptable=[0 0;0 1;1 1;1 0]; %QPSK格雷碼比特映射
for j=1:2:100for m=1:Mif isequal(s(j:j+1),Maptable(m,:)) Qu((j+1)/2)= (2*m-1)*pi/4;x((j+1)/2)=A(m);breakendend
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:Nsindex=(j-1)*Smpl+1:j*Smpl; %第i個符號對應的離散時間序號g(index)=1; %矩形脈沖成型X(index)=Am*g(index).*cos(2*pi*fc*t(index)+Qu(ceil(index/100.01))); %載波調制信號
end%subplot(313);plot(t,X);title('QPSK調制信號波形');SNR_dB=15; %定義信噪比
SNR=10^(SNR_dB/10); %定義線性信噪比
Ps=1; %發射功率
Pn=Ps/SNR; %噪聲方差
x=x(1:50);
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'); %y的星座圖title('QPSK接收星座圖');for j=1:length(y) Dist=abs(y(j)-A); %第j個接受信號與各星座圖點的距離[~,Index]=min(Dist); %找到距離最近的點x_est(j)=A(Index); %得到發射調制信號的估計s_est(2*j-1:2*j)=Maptable(Index,:); %得到比特數據的估計
end
W=1:100;
%subplot(212);stem(W,s_est);title('QPSK解調后信號');for n=1:25Pe_t(n)=2*sqrt(2)/4*erfc(sqrt(2*n)*sin(pi/M))-sqrt(2)/4*erfc(sqrt(2*n)*sin(pi/M))* sqrt(2)/4*erfc(sqrt(2*n)*sin(pi/M));Pb_t(n)=0.5*Pe_t(n);
end
PESUM=0;
PBSUM=0
for n=1:25
for m=1:1000SNR=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(2*j-1:2*j)=Maptable(Index,:);end
for k=1:100
if(s(k)+s_est(k)==1)PBSUM=PBSUM+1;
endend
for k1=1:50
if isequal(x(k1),x_est(k1))PESUM=PESUM+0;elsePESUM=PESUM+1;
end
end
end
Pb(n)=PBSUM/1000/100;
Pe(n)=PESUM/1000/50;
PBSUM=0;
PESUM=0;
endSNRX=1:25;
%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 25 0 1]);grid on;hold off;H=sqrt(1/2)*(randn+i*randn);
Y=H*x+z;
%figure(4);subplot(211);scatter(real(Y(1:10)),imag(Y(1:10)),'filled');title('4PSK信道均衡前星座圖');Y1=Y/H;
%subplot(212);scatter(real(Y1(1:10)),imag(Y1(1:10)),'filled');title('4PSK信道均衡后星座圖');
PESUM1=0;
PBSUM1=0
for n=1:25for m=1:1000SNR=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(2*j-1:2*j)=Maptable(Index,:);end
for k=1:100
if(s(k)+s_est1(k)==1)PBSUM1=PBSUM1+1;
end
end
for k1=1:50
if isequal(x(k1),x_est1(k1))PESUM1=PESUM1+0;elsePESUM1=PESUM1+1;
end
四、運行結果
五、matlab版本及參考文獻
1 matlab版本
2014a
2 參考文獻
[1] 沈再陽.精通MATLAB信號處理[M].清華大學出版社,2015.
[2]高寶建,彭進業,王琳,潘建壽.信號與系統——使用MATLAB分析與實現[M].清華大學出版社,2020.
[3]王文光,魏少明,任欣.信號處理與系統分析的MATLAB實現[M].電子工業出版社,2018.
總結
以上是生活随笔為你收集整理的【数字信号调制】基于matlab GUI QPSK调制+解调【含Matlab源码 646期】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Codeforces Round #71
- 下一篇: 天猫双 11 增长势能爆发:402 个品