📄 gen_dpcch_code.m
字号:
function y=gen_DPCCH_code(N_pilot)
%************************************************************************
%function y=gen_DPCCH_code(N_pilot)
%
% Copyright 2002 The Mobile and Portable Radio Research Group
%
%Generates the a simplified version of the DPCCH code. In this version,
%the pilot symbols in dach slot are generated as directed by the WDCMA
%specification, ETSI TS 125 211 V3.2.0 (2000-02). However, the remainder
%of the symbols are randomly generated.
%
%Parameters
% Input
% N_pilot Scalar Number of pilot symbols per slot
% Must be an integer between 3 and 8
%
% Output
% y Vector DPCCH code. Contains 150 symbols
%
%************************************************************************
%Check to make sure that N_pilot is between 3 and 8
if (N_pilot<3)|(N_pilot>8)
error(['N_pilot=',int2str(N_pilot),'! N_pilot must be between 3 and 8']);
end
if N_pilot==3
y(1:10)=[1 1 1 round(rand(1,7))];
y(11:20)=[0 0 1 round(rand(1,7))];
y(21:30)=[0 1 1 round(rand(1,7))];
y(31:40)=[0 0 1 round(rand(1,7))];
y(41:50)=[1 0 1 round(rand(1,7))];
y(51:60)=[1 1 1 round(rand(1,7))];
y(61:70)=[1 1 1 round(rand(1,7))];
y(71:80)=[1 0 1 round(rand(1,7))];
y(81:90)=[0 1 1 round(rand(1,7))];
y(91:100)=[1 1 1 round(rand(1,7))];
y(101:110)=[0 1 1 round(rand(1,7))];
y(111:120)=[1 0 1 round(rand(1,7))];
y(121:130)=[1 0 1 round(rand(1,7))];
y(131:140)=[0 0 1 round(rand(1,7))];
y(141:150)=[0 0 1 round(rand(1,7))];
elseif N_pilot==4
y(1:10)=[1 1 1 1 round(rand(1,6))];
y(11:20)=[1 0 0 1 round(rand(1,6))];
y(21:30)=[1 0 1 1 round(rand(1,6))];
y(31:40)=[1 0 0 1 round(rand(1,6))];
y(41:50)=[1 1 0 1 round(rand(1,6))];
y(51:60)=[1 1 1 1 round(rand(1,6))];
y(61:70)=[1 1 1 1 round(rand(1,6))];
y(71:80)=[1 1 0 1 round(rand(1,6))];
y(81:90)=[1 0 1 1 round(rand(1,6))];
y(91:100)=[1 1 1 1 round(rand(1,6))];
y(101:110)=[1 0 1 1 round(rand(1,6))];
y(111:120)=[1 1 0 1 round(rand(1,6))];
y(121:130)=[1 1 0 1 round(rand(1,6))];
y(131:140)=[1 0 0 1 round(rand(1,6))];
y(141:150)=[1 0 0 1 round(rand(1,6))];
elseif N_pilot==5
y(1:10)=[1 1 1 1 0 round(rand(1,5))];
y(11:20)=[0 0 1 1 0 round(rand(1,5))];
y(21:30)=[0 1 1 0 1 round(rand(1,5))];
y(31:40)=[0 0 1 0 0 round(rand(1,5))];
y(41:50)=[1 0 1 0 1 round(rand(1,5))];
y(51:60)=[1 1 1 1 0 round(rand(1,5))];
y(61:70)=[1 1 1 0 0 round(rand(1,5))];
y(71:80)=[1 0 1 0 0 round(rand(1,5))];
y(81:90)=[0 1 1 1 0 round(rand(1,5))];
y(91:100)=[1 1 1 1 1 round(rand(1,5))];
y(101:110)=[0 1 1 0 1 round(rand(1,5))];
y(111:120)=[1 0 1 1 1 round(rand(1,5))];
y(121:130)=[1 0 1 0 0 round(rand(1,5))];
y(131:140)=[0 0 1 1 1 round(rand(1,5))];
y(141:150)=[0 0 1 1 1 round(rand(1,5))];
elseif N_pilot==6
y(1:10)=[1 1 1 1 1 0 round(rand(1,4))];
y(11:20)=[1 0 0 1 1 0 round(rand(1,4))];
y(21:30)=[1 0 1 1 0 1 round(rand(1,4))];
y(31:40)=[1 0 0 1 0 0 round(rand(1,4))];
y(41:50)=[1 1 0 1 0 1 round(rand(1,4))];
y(51:60)=[1 1 1 1 1 0 round(rand(1,4))];
y(61:70)=[1 1 1 1 0 0 round(rand(1,4))];
y(71:80)=[1 1 0 1 0 0 round(rand(1,4))];
y(81:90)=[1 0 1 1 1 0 round(rand(1,4))];
y(91:100)=[1 1 1 1 1 1 round(rand(1,4))];
y(101:110)=[1 0 1 1 0 1 round(rand(1,4))];
y(111:120)=[1 1 0 1 1 1 round(rand(1,4))];
y(121:130)=[1 1 0 1 0 0 round(rand(1,4))];
y(131:140)=[1 0 0 1 1 1 round(rand(1,4))];
y(141:150)=[1 0 0 1 1 1 round(rand(1,4))];
elseif N_pilot==7
y(1:10)=[1 1 1 1 1 0 1 round(rand(1,3))];
y(11:20)=[1 0 0 1 1 0 1 round(rand(1,3))];
y(21:30)=[1 0 1 1 0 1 1 round(rand(1,3))];
y(31:40)=[1 0 0 1 0 0 1 round(rand(1,3))];
y(41:50)=[1 1 0 1 0 1 1 round(rand(1,3))];
y(51:60)=[1 1 1 1 1 0 1 round(rand(1,3))];
y(61:70)=[1 1 1 1 0 0 1 round(rand(1,3))];
y(71:80)=[1 1 0 1 0 0 1 round(rand(1,3))];
y(81:90)=[1 0 1 1 1 0 1 round(rand(1,3))];
y(91:100)=[1 1 1 1 1 1 1 round(rand(1,3))];
y(101:110)=[1 0 1 1 0 1 1 round(rand(1,3))];
y(111:120)=[1 1 0 1 1 1 1 round(rand(1,3))];
y(121:130)=[1 1 0 1 0 0 1 round(rand(1,3))];
y(131:140)=[1 0 0 1 1 1 1 round(rand(1,3))];
y(141:150)=[1 0 0 1 1 1 1 round(rand(1,3))];
elseif N_pilot==8
y(1:10)=[1 1 1 1 1 1 1 0 round(rand(1,2))];
y(11:20)=[1 0 1 0 1 1 1 0 round(rand(1,2))];
y(21:30)=[1 0 1 1 1 0 1 1 round(rand(1,2))];
y(31:40)=[1 0 1 0 1 0 1 0 round(rand(1,2))];
y(41:50)=[1 1 1 0 1 0 1 1 round(rand(1,2))];
y(51:60)=[1 1 1 1 1 1 1 0 round(rand(1,2))];
y(61:70)=[1 1 1 1 1 0 1 0 round(rand(1,2))];
y(71:80)=[1 1 1 0 1 0 1 0 round(rand(1,2))];
y(81:90)=[1 0 1 1 1 1 1 0 round(rand(1,2))];
y(91:100)=[1 1 1 1 1 1 1 1 round(rand(1,2))];
y(101:110)=[1 0 1 1 1 0 1 1 round(rand(1,2))];
y(111:120)=[1 1 1 0 1 1 1 1 round(rand(1,2))];
y(121:130)=[1 1 1 0 1 0 1 0 round(rand(1,2))];
y(131:140)=[1 0 1 0 1 1 1 1 round(rand(1,2))];
y(141:150)=[1 0 1 0 1 1 1 1 round(rand(1,2))];
end
y=-2*y+1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -