Sign in

username or email:

password:



Not a member?
Forgot your password?

Search code



Search tips

Ads

See Also

Embedded SystemsFPGA

DSP Code Sharing > WCDMA channelization code generator

WCDMA channelization code generator

Language: Matlab

Processor: Not Relevant

Submitted by Markus Nentwig on Nov 13 2010

Licensed under a Creative Commons Attribution 3.0 Unported License

WCDMA channelization code generator


 

Generates wideband CDMA channelization codes, based on 3GPP TS 25.213 V10.0.0 section 4.3.1.1

http://www.3gpp.org/ftp/Specs/archive/25_series/25.213/25213-a00.zip

 
% WCDMA channelization codes
% source:
% 3GPP TS 25.213 V10.0.0 section 4.3.1.1
%
% parameters:
% sf: spreading factor
% k: code number
%
% The returned code is a column vector with length sf
%
% this code has not been tested extensively. Please verify
% independently that it does what it promises.
function code=UTRA_FDD_chanCode(sf, k)
persistent flag;
persistent codes;

% * ********************************************
% * Build codebook
% * ********************************************
if isempty(flag)
  codes={};
  flag=1;
 
  % start of recursion: Identity code for sf=1
  codes{1, 1}=1;
  for sfi=1:8
    sfg=2 ^ sfi;
    for kgDest=0:2:sfg-2
      kgSrc=kgDest/2;
      prev=codes{sfg/2, kgSrc+1};
      % generation method:
      % - duplicate a lower-sf code
      % - duplicate and change sign
      codes{sfg, kgDest+1}=[prev prev];
      codes{sfg, kgDest+2}=[prev -prev];
    end
  end
end

% * ********************************************
% * look up the requested code from codebook
% * ********************************************
code=transpose(codes{sf, k+1});



% ################## CUT HERE #########################


% Example use (put this into a separate file)
sf=128; codenum=3;
chanCode=UTRA_FDD_chanCode(sf, codenum);

sig=[1 0 0 1 0 0 ]; % signal, row vector
len=size(sig, 2),
% convolve:
s=chanCode * sig; % now matrix, one row per repetition
len=len*sf;
s=reshape(s, 1, len);
% plot
stem(s);

 
 
Rate this code snippet:
0
Rating: 0 | Votes: 0
 
   
 
posted by Markus Nentwig
Markus received his Dipl. Ing. degree in electrical engineering / communications in 1999. Work interests include RF transceiver system design, implementation, modeling and verification. He works as senior architect for Renesas Mobile Europe in Finland.


Comments


No comments yet for this code


Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )