main_DSCDMA.m ( File view )

  • By lishan_wh 2013-09-27
  • View(s):75
  • Download(s):4
  • Point(s): 2
			% main_DSCDMA.m
% 这个仿真程序用于实现DS-CDMA通信系统仿真 
% 
% 

 
%+++++++++++++++++++++++准备部分+++++++++++++++++++++++++++ 

clear all;
clc 

sr   = 256000.0;          % 符号速率
ml   = 2;                 % 调制阶数 
br   = sr * ml;           % 比特速率 
nd   = 100;               % 符号数
SNR=-5:1:10;              % Eb/No 
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
%+++++++++++++++++++++滤波器初值设定+++++++++++++++++++++++ 
 
irfn   = 21;              % 滤波器阶数
IPOINT =  8;              % 过采样倍数
alfs   =  0.5;            % 滚降因子
[xh]   = hrollfcoef(irfn,IPOINT,sr,alfs,1);                         
[xh2]  = hrollfcoef(irfn,IPOINT,sr,alfs,0);                        
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
%++++++++++++++++++++++++扩频码初值设定+++++++++++++++++++ 
user  = 1;                % 用户数
seq   = 1;                % 1:m序列  2:Gold序列  3:正交Gold序列 
stage = 3;                % 序列阶数 
ptap1 = [1 3];            % 第一个线性移位寄存器的系数
ptap2 = [2 3];            % 第二个线性移位寄存器的系数
regi1 = [1 1 1];          % 第一个线性移位寄存器的初始化
regi2 = [1 1 1];          % 第二个线性移位寄存器的初始化
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

disp('--------------start-------------------');

%+++++++++++++++++扩频码的产生+++++++++++++++++ 
for ebn0=-5:1:10
switch seq 
case 1                                     % m序列
    code = mseq(stage,ptap1,regi1,user); 
case 2                                     % Gold序列
    m1   = mseq(stage,ptap1,regi1); 
    m2   = mseq(stage,ptap2,regi2); 
    code = goldseq(m1,m2,user); 
case 3                                     % 正交Gold序列
    m1   = mseq(stage,ptap1,regi1); 
    m2   = mseq(stage,ptap2,regi2); 
    code = [goldseq(m1,m2,user),zeros(user,1)]; 
end 
code = code * 2 - 1; 
clen = length(code); 
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
%+++++++++++++++++++++信道衰减初值设定+++++++++++++++++++++++ 
rfade  = 0;                             % 瑞利衰减 0:不考虑 1:考虑
itau   = [0,8];                         % 延时 
dlvl1  = [0.0,40.0];                    % 衰减电平
n0     = [6,7];                         % 用于产生衰落的波数
th1    = [0.0,0.0];                     % 延迟波形的初始相位
itnd1  = [3001,4004];                   % 设置衰落计数
now1   = 2;                             % 主径和延迟波形总数
tstp   = 1 / sr / IPOINT / clen;        % 时间分辨率
fd     = 160;                           % 多普勒频移[Hz] 
flat   = 1;                             % 平坦瑞利衰落环境
itndel = nd * IPOINT * clen * 30;                                 
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

%++++++++++++++++++++++仿真运算开始++++++++++++++++++++++++ 
nloop = 1000;                           % 仿真循环次数
noe   = 0; 
nod   = 0; 
 
for ii=1:nloop 
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     
%++++++++++++++++++++++++发射机++++++++++++++++++++++++++++ 
    data = rand(user,nd*ml) > 0.5; 
     
    [ich, qch]  = qpskmod(data,user,nd,ml);         % QPSK 调制
    [ich1,qch1] = spread(ich,qch,code);             % 扩频
    [ich2,qch2] = compoversamp2(ich1,qch1,IPOINT);  % 过采样
    [ich3,qch3] = compconv2(ich2,qch2,xh);          % 滤波
     
    if user == 1                                                    
        ich4 = ich3; 
        qch4 = qch3; 
    else 
        ich4 = sum(ich3); 
        qch4 = sum(qch3); 
    end 
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     
%+++++++++++++++++++++++衰减信道++++++++++++++++++++++++++  
    if rfade == 0 
        ich5 = ich4; 
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 2

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
01.96 kB
autocorr.m618.00 B2009-03-19|20:19
comb2.m738.00 B2009-03-21|13:42
compconv2.m595.00 B2009-03-19|20:19
compoversamp2.m686.00 B2009-03-19|20:19
crosscorr.m691.00 B2009-03-19|20:19
delay.m788.00 B2009-03-19|20:19
despread.m992.00 B2009-03-19|20:19
DS_CDMA113.00 kB2009-03-22|11:15
fade.m1.87 kB2009-03-19|20:57
goldseq.m627.00 B2009-03-19|20:19
hrollfcoef.m1.45 kB2009-03-19|20:36
main_DSCDMA.m5.58 kB2009-03-21|13:39
mseq.m1.09 kB2009-03-21|13:42
qpskdemod.m700.00 B2009-03-19|20:20
qpskmod.m935.00 B2009-03-19|20:20
sefade.m1.48 kB2009-03-19|21:11
shift.m1.22 kB2009-03-19|20:20
spread.m987.00 B2009-03-19|20:20
...
Sponsored links

main_DSCDMA.m (29.14 kB)

Need 2 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D