# What is Orthogonal Variable Spreading Factors? (A note about OVSF Codes)

With the advancement in the cellular technology and convergence of wireless technologies, now it is the need to combine two messages having different data rates in an orthogonal manner. Take an example, the date rate of user 1 is r1 and of user 2 is r2 and we have to spread the user 1 message by spreading factor s1 and that of user 2 by s2, so that we can produce and overall chip rate of ρ. we can use Walsh Hadamard sequences if the spreading factors are powers of 2. The result so obtained is referred to as Orthogonal Variable Spreading factor and is showed in figure 1.

Orthogonal Variable Spreading Factor - An Illustration

For OVSF the orthogonality requirement can be stated mathematically as (for the given figure)

ovsf orthogonality requirement

This is, code 1, of duration T1 is orthogonal to all subsequences of code 2, of the same length, and offset by a multiple of T1, the length of code 1.

Now, as we know, OVSF is important in terms of WCDMA and LTE, the question is how we will generate OVSF codes? We can generate OVSF codes by following algorithm.

Suppose we want to generate OVSF codes of length n1 and n2, where n1 < n2, then:

1. Construct Hn1 by usual Walsh-Hadamard algorithm.
2. Choose one row of matrix Hn1 as the code length of 2n1. Let Hn1 represent the Hadamard matrix with the selected row removed.
3. Continue the Walsh- Hadamard algorithm with Hn1: that is

Modified Matrix for OVSF

Then continue until desired Hn2 is constructed.

1. Choose any row of Hn2 as the spreading code of length 2n2
2. If a third code is needed, then continue in a similar manner.

Usage

% x = ovsf(y,z)

%x, the output cell array having required OVSF codes

%y, number of codes required

%z, array having length of each code to the base 2 i.e. 2.^2 = 4

%example y = 3 z = [4 2 3]

%this will give a cell array with [1×4] [1×8] [1×16]

%length = 2.^n , enter n in length of array

%The code is not optimized yet, user is free to optimize

================

Author : Ashwini Patankar

## 5 responses to “What is Orthogonal Variable Spreading Factors? (A note about OVSF Codes)”

1. santosh says:

hey ashwini,

the ovsf function works gr8.. but i’ve tried to optimise it to generate the codes sequentially, so code{1} will be the first code in the respective SF tree
and so on..but with no success… help??!!

2. Hi Santosh,

I did not get much time to look into the code and run it with modification. But i think, you want to generate say 3 codes of length [5 8 4], and want to get the out put matrix say X, having first row of length 5, second of 8 and 3rd of 4, I hope i am stating your problem correctly, if it is so then just comment line 24 i.e. len_codes = sort (len_codes);
I hope this will produce the desired results. else mention your problem with any small example, i.e. what will be the input and what will be the desired out put.

Thanks and Regards,
Ashwini Shankar Patankar

3. I want matlab coding for efficient channelization code management in WCDMA using ovsf codes to reduce code blocking problem and increasing the efficiency

4. Dear Dhivya,

check matlab file exchange

All the best,
Ashwini for WirelessCafe !!