资源简介
OFDM调制解调程序 MATLAB源代码
详细注释
代码片段和文件信息
%用m语言编制主程序如下:
clear all;
clc;
%----------------------preparation part -----------------------------
sr=256000.0; % symboll rate
ml=2; % number of modulation levels
br=sr*ml; % bit rate
nd=100; % number of symbol
ebno=8; % Ebno
%-----------------------------------------------Filter initialization-----------------
irfn=21;
IPOINT=8;
alfs=0.5;
[xh]=hrollfcoef(irfnIPOINTsralfs1); % Transmitting Filter
[xh2]=hrollfcoef(irfnIPOINTsralfs0); % Received Filter
%------------------------------ Spreading code initialization--------------------
user=1; % number of users
seq=1; % 1:m-sequence 2:Gold 3:orthogonal Gold
stage=3;
ptap1=[1 3];
ptap2=[2 3];
regi1=[1 1 1];
regi2=[1 1 1];
% ----------------------------- Generation of the spreading code --------
switch seq
case 1
code=mseq(stageptap1regi1user);
case 2
m1=mseq(stageptap1regi1);
m2=mseq(stageptap2regi2);
code=goldseq(m1m2user);
case 3
m1=mseq(stageptap1regi1);
m2=mseq(stageptap2regi2);
code=[goldseq(m1m2user)zeros(user1)];
end
code=code*2-1;
clen=length(code);
% ---------------------------------- Fading initialization ---------------
rfade=0; % Rayleigh fading 0:nothing 1:consider
itau=[08]; % delay time
dlvl1=[0.040.0]; % attenuation level
n0=[67];
th1=[0.00.0];
itnd1=[30014004];
now1=2;
tstp=1/sr/IPOINT/clen; % time resolution
fd=160;
flat=1;
itnde1=nd*IPOINT*clen*30;
% ----------------------------- Start calculation -------------
nloop=1000;
noe=0;
nod=0;
for ii=1:nloop
% -------------------------- Transmitter ---------------------
data=rand(usernd*ml)>0.5;
[ichqch]=qpskmod(datauserndml);
[ich1qch1]=spread(ichqchcode);
[ich2qch2]=compoversamp2(ich1qch1IPOINT);
[ich3qch3]=compconv2(ich2qch2xh);
if user==1
ich4=ich3;
qch4=qch3;
else
ich4=sum(ich3);
qch4=sum(qch3);
end
% -------------------------- Fading channel -------------------
if rfade==0
ich5=ich4;
qch5=qch4;
else
[ich5qch5]=sefade(ich4qch4itaudlvl1th1n0itnd1...
now1length(ich4)tstpfdflat);
itnd1=itnd1+itnde1;
end
% ---------------------------------- Receiver -----------------------------
spow=sum(rot90(ich3.^2+qch3.^2))/nd;
attn=sqrt(0.5*spow*sr/br*10^(-ebno/10));
[ich6qch6]=comb2(ich5qch5attn);
[ich7qch7]=compconv2(ich6qch6xh2); % filter
samp1=irfn*IPOINT+1;
ich8=ich7(:samp1:IPOINT:IPOINT*nd*clen+samp1-1);
qch8=qch7(:samp1:IPOINT:IPOINT*nd*clen+samp1-1);
[ich9 qch9]=despread(ich8qch8code);
demodata=qpskdemod(ich9qch9userndml); % QPSK demodulation
%--
- 上一篇:简单的声音滤波 matlab
- 下一篇:粒子滤波算法 matlab
相关资源
- 粒子滤波算法 matlab
- 简单的声音滤波 matlab
- 基于栅格地图的Dijkstra算法路径规划
- Matlab一维FDTD卷积边界条件CPML
- SMOTE结合SVM算法matlab实现
- MATLAB文字识别程序解析
- 基于MATLAB的血管三维重建
- Allan方差计算程序Matlab版
- Goldstein_Filter
- matlab 图像加噪去噪
- 随机相位正弦波仿真实验MATLAB程序
- MATLAB图像识别80192
- 模糊神经网络matlab源程序
- 三维B样条函数的matlab实现
- 基于matlab的工件缺陷检测
- matlab生成可见性图程序
- matlab 图像校正
- matlab编写的流体计算和传热程序
- 基于粒子群优化算法的模糊c聚类源码
- ACSS角点检测程序
- MUSIC算法的DOA估计的matlab仿真程序
- capon算法Doa估计测角精度仿真matlab
- LFM仿真的matlab程序
- 基于MATLAB的语音滤波实验设计
- 轮廓跟踪法提取图像轮廓MATLAB源码
- HIV传染动力学模型
- GMSK调制解调的MATLAB实现
- 自抗扰matlab程序代码
- TCM网格编码调制matlab仿真完整版
- MATLAB 图像增强程序
评论
共有 条评论