Documentation |
Generate orthogonal variable spreading factor (OVSF) code from set of orthogonal codes
The OVSF Code Generator block generates an OVSF code from a set of orthogonal codes. OVSF codes were first introduced for 3G communication systems. OVSF codes are primarily used to preserve orthogonality between different channels in a communication system.
OVSF codes are defined as the rows of an N-by-N matrix, C_{N}, which is defined recursively as follows. First, define C_{1} = [1]. Next, assume that C_{N} is defined and let C_{N}(k) denote the kth row of C_{N}. Define C_{2N} by
$${C}_{2N}=\left[\begin{array}{cc}{C}_{N}(0)& {C}_{N}(0)\\ {C}_{N}(0)& -{C}_{N}(0)\\ {C}_{N}(1)& {C}_{N}(1)\\ {C}_{N}(1)& -{C}_{N}(1)\\ \mathrm{...}& \mathrm{...}\\ {C}_{N}(N-1)& {C}_{N}(N-1)\\ {C}_{N}(N-1)& -{C}_{N}(N-1)\end{array}\right]$$
Note that C_{N }is only defined for N a power of 2. It follows by induction that the rows of C_{N }are orthogonal.
The OVSF codes can also be defined recursively by a tree structure, as shown in the following figure.
If [C] is a code length 2^{r} at depth r in the tree, where the root has depth 0, the two branches leading out of C are labeled by the sequences [C C] and [C -C], which have length 2^{r+1}. The codes at depth r in the tree are the rows of the matrix C_{N}, where N = 2^{r}.
Note that two OVSF codes are orthogonal if and only if neither code lies on the path from the other code to the root. Since codes assigned to different users in the same cell must be orthogonal, this restricts the number of available codes for a given cell. For example, if the code C_{41} in the tree is assigned to a user, the codes C_{10}, C_{20}, C_{82}, C_{83}, and so on, cannot be assigned to any other user in the same cell.
You specify the code the OVSF Code Generator block outputs by two parameters in the block's dialog: the Spreading factor, which is the length of the code, and the Code index, which must be an integer in the range [0, 1, ... , N - 1], where N is the spreading factor. If the code appears at depth r in the preceding tree, the Spreading factor is 2^{r}. The Code index specifies how far down the column of the tree at depth r the code appears, counting from 0 to N - 1. For C_{N, k} in the preceding diagram, N is the Spreading factor and k is the Code index.
You can recover the code from the Spreading factor and the Code index as follows. Convert the Code index to the corresponding binary number, and then add 0s to the left, if necessary, so that the resulting binary sequence x_{1} x_{2} ... x_{r} has length r, where r is the logarithm base 2 of the Spreading factor. This sequence describes the path from the root to the code. The path takes the upper branch from the code at depth i if x_{i} = 0, and the lower branch if x_{i} = 1.
To reconstruct the code, recursively define a sequence of codes C_{i} for as follows. Let C_{0} be the root [1]. Assuming that C_{i} has been defined, for i < r, define C_{i+1} by
$${C}_{i+1}=\{\begin{array}{ll}{C}_{i}{C}_{i}\hfill & \text{if}{x}_{i}=0\hfill \\ {C}_{i}(-{C}_{i})\hfill & \text{if}{x}_{i}=1\hfill \end{array}$$
The code C_{N} has the specified Spreading factor and Code index.
For example, to find the code with Spreading factor 16 and Code index 6, do the following:
Convert 6 to the binary number 110.
Add one 0 to the left to obtain 0110, which has length 4 = log_{2} 16.
Construct the sequences C_{i} according to the following table.
i | x_{i} | C_{i} |
---|---|---|
0 | C_{0} = [1] | |
1 | 0 | C_{1} = C_{0} C_{0} = [1] [1] |
2 | 1 | C_{2} = C_{1} -C_{1} = [1 1] [-1 -1] |
3 | 1 | C_{3} = C_{2} -C_{2} = [1 1 -1 -1] [-1 -1 1 1] |
4 | 0 | C_{4} = C_{3} C_{3} = [1 1 -1 -1 -1 -1 1 1] [1 1 -1 -1 -1 -1 1 1] |
The code C_{4 }has Spreading factor 16 and Code index 6.
Positive integer that is a power of 2, specifying the length of the code.
Integer in the range [0, 1, ... , N - 1] specifying the code, where N is the Spreading factor.
A positive real scalar specifying the sample time of the output signal.
Determines whether the output is frame-based or sample-based.
The number of samples in a frame-based output signal. This field is active only if you select Frame-based outputs.
The output type of the block can be specified as an int8 or double. By default, the block sets this to double.