⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oqpsk.m

📁 利用matlab软件对各种频率选择性信道进行仿真
💻 M
字号:
% Program 3-11
% Oqpsk.m

% Simulation program to realize OQPSK transmission system.
%----------------------preparation part ---------------
clear all;
clc;
sr=256000.0;
ml=2;
br=sr.*ml;
nd=1000;
ebn0=3;
IPOINT=8;


%---------------------- Filter initialization -------------
irfn=21;
alfs=.5;
[xh]=hrollfcoef(irfn,IPOINT,sr,alfs,1);
[xh2]=hrollfcoef(irfn,IPOINT,sr,alfs,0);

%-------------------- Start calculation -------------------
nloop=100;
noe=0;
nod=0;
for iii=1:nloop
 
% -----------------Data generation -------------------
data1=rand(1,nd*ml)>0.5;

%---------------------  OQPSK --------------------
[ich,qch]=qpskmod(data1,1,nd,ml);
[ich1,qch1]=compoversamp(ich,qch,length(ich),...
    IPOINT);
ich21=[ich1 zeros(1,IPOINT/2)];
qch21=[zeros(1,IPOINT/2) qch1];
[ich2,qch2]=compconv(ich21,qch21,xh);

%---------------Attenuation Calculation ----------------
spow=sum(ich2.*ich2+qch2.*qch2)/nd;
attn=.5*spow*sr/br*10.^(-ebn0/10);
attn=sqrt(attn);

%-------------------- Fading channel ------------------
% [ifade,qfade]=sefade(ich2,qch2,itau,dlvl,th1,n0,itnd1,now1,length(ich1),tstp,fd,flat);
% itnd1=itnd1+itnd0

%--------------------- AWGN -----------------------
[ich3,qch3]=comb(ich2,qch2,attn);
[ich4,qch4]=compconv(ich3,qch3,xh2);
syncpoint=irfn*IPOINT+1;
ich5=ich4(syncpoint:IPOINT:length(ich4));
qch5=qch4(syncpoint+IPOINT/2:IPOINT:length(qch4));

%---------------OQPSK Demodulation ----------------
[demodata]=qpskdemod(ich5,qch5,1,nd,ml);

%----------------BER-----------------------------
noe2=sum(abs(data1-demodata));
nod2=length(data1);
noe=noe+noe2;
nod=nod+nod2;
fprintf('%d\t%e\n',iii,noe2/nod2);
end
ber=noe/nod;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -