📄 wcdmadespread.m
字号:
function [y,z]=WCDMADespread(unscrambled_signal,chan_code,N)
%******************************************************************************
%function [y,z]=WCDMADespread(unscrambled_signal,chan_code,N)
%
%Copyright 2002 The Mobile and Portable Radio Research Group
%
%Despeads the incoming chip sequence's (the function can accept multiple
%sequences in a columnwise format) into the associated control bit
%sequences and data bit sequences. For each input chip sequence, this
%function will return one control bit sequence, y, and N data bit sequences
%where 1<=N<=6 corresponding the number of DPDCH's contained in the signal.
%The data sequences are stored in 'z'. The data bit sequences are stored
%as follows:
% A_1(d11+jd12)
% A_1(d13+jd14)
% A_1(d15+jd16)
% A_2(d21+jd22)
% A_2(d23+jd24)
% A_2(d25+jd26)
% ...
% ...
% A_K(dK1+jdK2)
% A_K(dK3+jdK4)
% A_K(dK5+jdK6)
%
%Notice that the above example is for the case were N=6. The coeficients, A_k,
%are complex coefficients due to gains and rotations found either in the channel
%or due to antenna array response characteristcs. Note that K=the number of
%chip sequences containd in "unscrambled_singal", which is also the number of
%columns. N is the number of DPDCH's containd %in the chip sequence (This is
%the same of all K chip sequences)
%
% Parameters
% Input
% unscrambled_signal matrix Contains chipping sequences in a
% columnwise format. Number of columns
% indicate the number of chipping
% sequences
% chan_code matrix Channel code matrix. If N>1, then
% "chan_code" must be a 4x4 matrix
% N scalar Number of DPDCH's in the chipping
% sequences
% Output
% y matrix Contains the control bit sequence from
% each chipping sequence. The number
% of rows equals the number of chipping
% sequences.
% z matrix Contains the databit sequences for each
% chipping sequence in a row wise fashion.
% The storage format is shown above
%******************************************************************************
ChipLength=38400;
%Only 6 data channels are allowed
if (N<1)|(N>6), error('N must be between 1 and 6'); end
%For the case where N>1, check to see if chan_code is a 4x4 matrix
[nrow,ncol]=size(chan_code);
if N>1
if nrow~=4
error(['SF=',int2str(nrow),', N=',int2str(N),'! spreading factor must equal 4 if N>1']);
end
end
%Determine spreading factor
SF=nrow;
%Determine the number of chipping sequences
[row,K]=size(unscrambled_signal);
%create spreading code for control channel
ControlCode=ones(1,256);
%Despread Control Channel
for k=1:K
SpreadSignal=reshape(unscrambled_signal(:,k),256,150);
y(k,:)=ControlCode*SpreadSignal;
end
y = (-j)*y;
%Despread Data Channels
if N>1 %We have more than one DPDCH in the signal
index=1;
kk=[1 1 3 3 2 2]+1;
for k=1:K
SpreadSignal=reshape(unscrambled_signal(:,k),SF,9600);
for n=1:2:N
z(index,:)=chan_code(kk(n),:)*SpreadSignal;
if rem(n,2)==0, z(index,:)=-j*z(index,:); end
index=index+1;
end
end
else %Then there is only one DPDCH in the signal
kk=(SF/4)+1;
SymbolLength=ChipLength/SF;
for k=1:K
SpreadSignal=reshape(unscrambled_signal(:,k),SF,SymbolLength);
z(k,:)=chan_code(kk,:)*SpreadSignal;
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -