summaryrefslogtreecommitdiff
path: root/macros/lteZadoffChuSeq.sci
blob: 862e2683ac191f49b5ede27d99ba1898141f9386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function seq = lteZadoffChuSeq(R, N)
//   This function generates root Zadoff-Chu sequence of complex symbols as per LTE specifications.
//
//   Calling sequence
//   SEQ = LTEZADOFFCHUSEQ(R, N)
//
//   Description
//   SEQ = LTEZADOFFCHUSEQ(R, N) generates the Rth root Zadoff-Chu sequence (SEQ)
//   of length N.
//
//   Examples
//   seq1 = lteZadoffChuSeq(2, 3)
//   disp(seq1,'seq1')
//   //Error should occur because inputs are not co primes
//   seq2 = lteZadoffChuSeq(25, 5)
//   disp(seq2,'seq2')
//
//
//   Bibliography 
//   3rd Generation Partnership Project, Technical Specification Group Radio
//   Access Network, Evolved Universal Terrestrial Radio Access (E-UTRA),
//   Physical channels and modulation, Release 10, 3GPP TS 36.211, v10.0.0,
//   2010-12.
//
//   Authors
//   Pola Lakshmi Priyanka, IIT Bombay

//*************************************************************************************************************************************//

//Input argument check
[out_a,inp_a]=argn(0)

if inp_a~=2 then
    error('comm:lteZadoffChuSeq:Invalid number of input arguments')
end

if out_a>1 then
    error('comm:lteZadoffChuSeq:Invalid number of output arguments')
end

// Error Check for input arguments
if(~isscalar(R) | ~or(type(R)==[1 5 8]) | ~isreal(R) | R==%inf | R~=floor(R) | R<=0) then
    error('comm:lteZadoffChuSeq: Input argument 1 should be a finite positive integer')
end

if(~isscalar(N) | ~or(type(N)==[1 5 8]) | ~isreal(N) | N==%inf | N~=floor(N) | N<=0 | modulo(N,2)==0) then
    error('comm:lteZadoffChuSeq:Input argument 2 is invalid')
end

if(gcd(uint8([R N])) ~= 1) then
    error('comm:lteZadoffChuSeq:Both the input arguments should be co primes')
end


m = (0:N-1).';
seq = exp( -complex(0,1) * %pi * R * m.*(m+1) / N );

endfunction