一、简介
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});
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_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:100
for m=1:M
if isequal(s(j:j+1),Maptable(m,:))
Qu((j+1)/2)= (2*m-1)*pi/4;
x((j+1)/2)=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: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:25
Pe_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: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(2*j-1:2*j)=Maptable(Index,:);
end
for k=1:100
if(s(k)+s_est(k)==1)
PBSUM=PBSUM+1;
end
end
for k1=1:50
if isequal(x(k1),x_est(k1))
PESUM=PESUM+0;
else
PESUM=PESUM+1;
end
end
end
Pb(n)=PBSUM/1000/100;
Pe(n)=PESUM/1000/50;
PBSUM=0;
PESUM=0;
end
SNRX=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:25
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(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;
else
PESUM1=PESUM1+1;
end- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
- 158.
- 159.
- 160.
- 161.
- 162.
- 163.
- 164.
- 165.
- 166.
- 167.
- 168.
- 169.
- 170.
- 171.
- 172.
- 173.
- 174.
- 175.
- 176.
- 177.
- 178.
- 179.
- 180.
- 181.
- 182.
- 183.
- 184.
- 185.
- 186.
- 187.
- 188.
- 189.
- 190.
- 191.
- 192.
- 193.
- 194.
- 195.
- 196.
- 197.
三、运行结果





1642

被折叠的 条评论
为什么被折叠?



